diff 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
line wrap: on
line diff
--- a/frontends/src/jp/base.py	Thu Mar 29 08:57:27 2018 +0200
+++ b/frontends/src/jp/base.py	Thu Mar 29 08:59:38 2018 +0200
@@ -353,6 +353,9 @@
         elif flags.multi_items:
             # mutiple items
             pubsub_group.add_argument("-i", "--item", type=unicode_decoder, action='append', dest='items', default=[], help=_(u"items to retrieve (DEFAULT: all)"))
+            if not flags.no_max:
+                pubsub_group.add_argument("-m", "--max", type=int, default=10,
+                    help=_(u"maximum number of items to get ({no_limit} to get all items)".format(no_limit=C.NO_LIMIT)))
 
         if flags:
             raise exceptions.InternalError('unknowns flags: {flags}'.format(flags=u', '.join(flags)))