jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/507352 )
Change subject: [IMPR] Improvements for arg parsing in commonscat.py ......................................................................
[IMPR] Improvements for arg parsing in commonscat.py
Step 2 of commonscat.py improvements
Change-Id: I343e59706266968894e854c99e7783c6e0a321cc --- M scripts/commonscat.py 1 file changed, 8 insertions(+), 9 deletions(-)
Approvals: Framawiki: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/commonscat.py b/scripts/commonscat.py index 1be4a49..889c5f8 100755 --- a/scripts/commonscat.py +++ b/scripts/commonscat.py @@ -526,16 +526,15 @@ genFactory = pagegenerators.GeneratorFactory()
for arg in local_args: - if arg.startswith('-summary'): - if len(arg) == 8: - options['summary'] = pywikibot.input( - 'What summary do you want to use?') - else: - options['summary'] = arg[9:] - elif arg.startswith('-checkcurrent'): + opt, _, value = arg.partition(':') + option = opt[1:] if opt[0] == '-' else None + if option == 'summary': + options[option] = value or pywikibot.input( + 'What summary do you want to use?') + elif option == 'checkcurrent': checkcurrent = True - elif arg == '-always': - options['always'] = True + elif option == 'always': + options[option] = True else: genFactory.handleArg(arg)