comparison frontends/src/jp/base.py @ 2539:dcc77f23e370

jp (base): add --max option: when MULTI_ITEMS is set, --max options is automatically added, except if NO_MAX flag is set.
author Goffi <goffi@goffi.org>
date Thu, 29 Mar 2018 08:59:38 +0200
parents 0a22dc80d671
children 2d69a0afe039
comparison
equal deleted inserted replaced
2538:0a22dc80d671 2539:dcc77f23e370
351 pubsub_group.add_argument("-i", "--item", type=unicode_decoder, help=_(u"item to retrieve")) 351 pubsub_group.add_argument("-i", "--item", type=unicode_decoder, help=_(u"item to retrieve"))
352 pubsub_group.add_argument("-L", "--last-item", action='store_true', help=_(u'retrieve last item')) 352 pubsub_group.add_argument("-L", "--last-item", action='store_true', help=_(u'retrieve last item'))
353 elif flags.multi_items: 353 elif flags.multi_items:
354 # mutiple items 354 # mutiple items
355 pubsub_group.add_argument("-i", "--item", type=unicode_decoder, action='append', dest='items', default=[], help=_(u"items to retrieve (DEFAULT: all)")) 355 pubsub_group.add_argument("-i", "--item", type=unicode_decoder, action='append', dest='items', default=[], help=_(u"items to retrieve (DEFAULT: all)"))
356 if not flags.no_max:
357 pubsub_group.add_argument("-m", "--max", type=int, default=10,
358 help=_(u"maximum number of items to get ({no_limit} to get all items)".format(no_limit=C.NO_LIMIT)))
356 359
357 if flags: 360 if flags:
358 raise exceptions.InternalError('unknowns flags: {flags}'.format(flags=u', '.join(flags))) 361 raise exceptions.InternalError('unknowns flags: {flags}'.format(flags=u', '.join(flags)))
359 362
360 return parent 363 return parent