Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/785119 )
Change subject: [IMPR] Reword add_text argument descriptions to be more succinct. ......................................................................
[IMPR] Reword add_text argument descriptions to be more succinct.
Also position add_text -help arguments above '¶ms;'
Change-Id: I7bdb0d52facaa93eac41feb11b438f0cb3423af9 --- M scripts/add_text.py M tests/add_text_tests.py 2 files changed, 21 insertions(+), 22 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/scripts/add_text.py b/scripts/add_text.py index b8b2e0e..f221e39 100755 --- a/scripts/add_text.py +++ b/scripts/add_text.py @@ -1,22 +1,18 @@ #!/usr/bin/python3 r""" -This is a Bot to add text to the top or bottom of a page. +Append text to the top or bottom of a page.
By default this adds the text to the bottom above the categories and interwiki.
-These command line parameters can be used to specify which pages to work on: +Use the following command line parameters to specify what to add:
-¶ms; +-text Text to append. "\n" are interpreted as newlines.
-Furthermore, the following command line parameters are supported: +-textfile Path to a file with text to append
--text Define what text to add. "\n" are interpreted as newlines. +-summary Change summary to use
--textfile Define a texfile name which contains the text to add - --summary Define the summary to use - --up If used, put the text at the top of the page +-up Append text to the top of the page rather than the bottom
-create Create the page if necessary. Note that talk pages are created already without of this option. @@ -31,13 +27,16 @@ -talkpage Put the text onto the talk page instead -talk
--excepturl Use the html page as text where you want to see if there's - the text, not the wiki-page. +-excepturl Skip pages with a url that matches this regular expression
--noreorder Avoid reordering cats and interwiki +-noreorder Place the text beneath the categories and interwiki
-Example -------- +Furthermore, the following can be used to specify which pages to process... + +¶ms; + +Examples +--------
1. Append 'hello world' to the bottom of the sandbox:
@@ -93,7 +92,6 @@ '-excepturl': 'What url pattern should we skip?', }
- docuReplacements = {'¶ms;': pagegenerators.parameterHelp} # noqa: N816
@@ -199,12 +197,13 @@ generator_factory: pagegenerators.GeneratorFactory ) -> ARGS_TYPE: """ - Parses our arguments and provide a named tuple with their values. + Parses our arguments and provide a dictionary with their values.
:param argv: input arguments to be parsed - :param generator_factory: factory that will determine the page to edit + :param generator_factory: factory that will determine what pages to + process :return: dictionary with our parsed arguments - :raise ValueError: invalid arguments received + :raise ValueError: if we receive invalid arguments """ args = dict(DEFAULT_ARGS) argv = pywikibot.handle_args(argv) diff --git a/tests/add_text_tests.py b/tests/add_text_tests.py index adbfe21..0e7bc62 100755 --- a/tests/add_text_tests.py +++ b/tests/add_text_tests.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -"""Test add_text bot module.""" +"""Test add_text script.""" # # (C) Pywikibot team, 2016-2022 # @@ -29,9 +29,9 @@ return page
-class TestAdding(TestCase): +class TestAddTextScript(TestCase):
- """Test adding text.""" + """Test add_text script."""
family = 'wikipedia' code = 'en'
pywikibot-commits@lists.wikimedia.org