replicate_wiki does not call handleArgs, and uses argparse without offering something like -help.
Version: core-(2.0)
Severity: major
replicate_wiki does not call handleArgs, and uses argparse without offering something like -help.
Version: core-(2.0)
Severity: major
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | None | T52344 Set up unit test running for pywikibot/core | |||
Resolved | jayvdb | T71068 split test suite into tests which depend on a server, and those that do not | |||
Invalid | None | T72936 Important tasks to be solved (tracking) | |||
Resolved | Xqt | T193968 Missing unittests for scripts (tracking) | |||
Resolved | Xqt | T71069 Scripts which are not properly tested by script_tests (tracking) | |||
Resolved | murfel | T70664 replicate_wiki doesnt support help or other global command line options |
--help or -h would do:
$ python pwb.py scripts/replicate_wiki.py -h
usage: replicate_wiki.py [-h] [-f FAMILY] [-r] [-o ORIGINAL_WIKI]
[-ns NAMESPACE] [-dns DEST_NAMESPACE] destination [destination ...]
positional arguments:
destination destination wiki(s)
optional arguments:
-h, --help show this help message and exit -f FAMILY, --family FAMILY wiki family -r, --replace actually replace pages (without this option you will only get an overview page) -o ORIGINAL_WIKI, --original ORIGINAL_WIKI original wiki -ns NAMESPACE, --namespace NAMESPACE specify namespace -dns DEST_NAMESPACE, --dest-namespace DEST_NAMESPACE destination namespace (if different)
Note handleArgs has been replaced with handle_args.
--help does emi the above, bit --help/-help should also show the global options which are documented in pywikibot/bot.py showHelp() variable globalHelp
this is tested by tests/script_tests.py - edit that file to see replicate_wiki.py is treated differently because it doesnt emit the standard global help message.
Noting that this is a claimed CGI task https://www.google-melange.com/gci/task/view/google/gci2014/5790882494152704
Welcome murfel. You can ask questions here (public) or on melange (private) or on IRC (also private; more fluid discussion). Once the first patch is up, discussion often happens in the gerrit system. See https://gerrit.wikimedia.org/r/#/c/176747/ for an example (another CGI task, recently finished)
Right now replicate_wiki.py uses argparse to parse local arguments. Once handle_args is added to parse global arguments, should it parse local arguments too? If use combination of both handle_args for global and argparse for local arguments then -h would look like
$ python pwb.py scripts/replicate_wiki.py -h
Introduction … (given by handle_args)
Global arguments …
usage: … (given by argparse)
positional arguments: …
optional arguments: …
There is a similar script editarticle.py which has been fixed recently see T70617 and https://gerrit.wikimedia.org/r/#/c/176747/.
I'd deactivate --help (it will be supported for all scripts with T76429) via the add_help=False argument. The help is then handled by the handle_args if -help is used.
Change 177216 had a related patch set uploaded (by Murfel):
T70664 Added global options support
Change 177216 had a related patch set uploaded (by Murfel):
Added global options support