jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] Make example commands in help similar ......................................................................
[IMPROV] Make example commands in help similar
Always use a similar structure for the commands in the scripts' docstrings by using pwb.py, omitting the file extension of the script, using backslashes to indicate a multi line command and indent them.
In the transferbot script the commands have been changed to use actual families.
Change-Id: Ic1f2626f533c024348fe298ed6b07e6414d395b1 --- M scripts/add_text.py M scripts/blockpageschecker.py M scripts/capitalize_redirects.py M scripts/catall.py M scripts/category.py M scripts/category_redirect.py M scripts/cfd.py M scripts/claimit.py M scripts/commons_link.py M scripts/commonscat.py M scripts/coordinate_import.py M scripts/create_categories.py M scripts/data_ingestion.py M scripts/delete.py M scripts/disambredir.py M scripts/featured.py M scripts/harvest_template.py M scripts/illustrate_wikidata.py M scripts/image.py M scripts/imagetransfer.py M scripts/lonelypages.py M scripts/maintenance/cache.py M scripts/maintenance/compat2core.py M scripts/match_images.py M scripts/nowcommons.py M scripts/piper.py M scripts/protect.py M scripts/redirect.py M scripts/replace.py M scripts/replicate_wiki.py M scripts/script_wui.py M scripts/shell.py M scripts/solve_disambiguation.py M scripts/spamremove.py M scripts/template.py M scripts/templatecount.py M scripts/transferbot.py M scripts/unlink.py M scripts/watchlist.py M scripts/weblinkchecker.py 40 files changed, 150 insertions(+), 102 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py index 0fb2f28..cb8d2d4 100755 --- a/scripts/add_text.py +++ b/scripts/add_text.py @@ -42,17 +42,17 @@ # category:catname # Warning! Put it in one line, otherwise it won't work correctly.
-python add_text.py -cat:catname -summary:"Bot: Adding a template" --text:"{{Something}}" -except:"{{([Tt]emplate:|)[Ss]omething" -up + python pwb.py add_text -cat:catname -summary:"Bot: Adding a template" \ + -text:"{{Something}}" -except:"{{([Tt]emplate:|)[Ss]omething" -up
2. # Command used on it.wikipedia to put the template in the page without any # category. # Warning! Put it in one line, otherwise it won't work correctly.
-python add_text.py -excepturl:"class='catlinks'>" -uncat --text:"{{Categorizzare}}" -except:"{{([Tt]emplate:|)[Cc]ategorizzare" --summary:"Bot: Aggiungo template Categorizzare" + python pwb.py add_text -except:"{{([Tt]emplate:|)[Cc]ategorizzare" \ + -text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \ + -summary:"Bot: Aggiungo template Categorizzare"
--- Credits and Help --- This script has been written by Botwiki's staff, if you want to help us diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py index 7a671ee..c4ca412 100755 --- a/scripts/blockpageschecker.py +++ b/scripts/blockpageschecker.py @@ -39,11 +39,11 @@
--- Example of how to use the script ---
-python blockpageschecker.py -always + python pwb.py blockpageschecker -always
-python blockpageschecker.py -cat:Geography -always + python pwb.py blockpageschecker -cat:Geography -always
-python blockpageschecker.py -show -protectedpages:4 + python pwb.py blockpageschecker -show -protectedpages:4
""" # diff --git a/scripts/capitalize_redirects.py b/scripts/capitalize_redirects.py index 82b93c0..c82e0c2 100755 --- a/scripts/capitalize_redirects.py +++ b/scripts/capitalize_redirects.py @@ -16,7 +16,9 @@ where all words of the title start with an uppercase character and the remaining characters are lowercase.
-Example: "python capitalize_redirects.py -start:B -always" +Example: + + python pwb.py capitalize_redirects -start:B -always """ # # (C) Yrithinnd, 2006 diff --git a/scripts/catall.py b/scripts/catall.py index cc065e0..f2042ef 100755 --- a/scripts/catall.py +++ b/scripts/catall.py @@ -10,7 +10,8 @@ list of categories to replace the current list of categories of the page.
Usage: - catall.py [start] + + python pwb.py catall [start]
If no starting name is provided, the bot starts at 'A'.
diff --git a/scripts/category.py b/scripts/category.py index ad4d119..891a57e 100755 --- a/scripts/category.py +++ b/scripts/category.py @@ -3,7 +3,9 @@ """ Scripts to manage categories.
-Syntax: python category.py action [-option] +Syntax: + + python pwb.py category action [-option]
where action can be one of these: * add - mass-add a category to a list of pages @@ -89,13 +91,13 @@
For example, to create a new category from a list of persons, type:
- python category.py add -person + python pwb.py category add -person
and follow the on-screen instructions.
Or to do it all from the command-line, use the following syntax:
- python category.py move -from:US -to:'United States' + python pwb.py category move -from:US -to:"United States"
This will move all pages in the category US to the category United States.
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py index 6f0378f..70c7e9c 100755 --- a/scripts/category_redirect.py +++ b/scripts/category_redirect.py @@ -17,7 +17,9 @@ moves all images, pages and categories in redirect categories to the target category.
-Usage: category_redirect.py [options] +Usage: + + python pwb.py category_redirect [options]
""" # diff --git a/scripts/cfd.py b/scripts/cfd.py index 5a6eaca..698f679 100755 --- a/scripts/cfd.py +++ b/scripts/cfd.py @@ -6,7 +6,9 @@ It parses out the actions that need to be taken as a result of CFD discussions (as posted to the working page by an administrator) and performs them.
-Syntax: python cfd.py +Syntax: + + python pwb.py cfd
""" # diff --git a/scripts/claimit.py b/scripts/claimit.py index 099d9a2..5f11c76 100755 --- a/scripts/claimit.py +++ b/scripts/claimit.py @@ -7,7 +7,7 @@
Usage:
-python claimit.py [pagegenerators] P1 Q2 P123 Q456 + python pwb.py claimit [pagegenerators] P1 Q2 P123 Q456
You can use any typical pagegenerator to provide with a list of pages. Then list the property-->target pairs to add. @@ -16,7 +16,7 @@
For geographic coordinates:
-python claimit.py [pagegenerators] P625 [lat-dec],[long-dec],[prec] + python pwb.py claimit [pagegenerators] P625 [lat-dec],[long-dec],[prec]
[lat-dec] and [long-dec] represent the latitude and longitude respectively, and [prec] represents the precision. All values are in decimal degrees, @@ -24,14 +24,14 @@
Example:
-python claimit.py [pagegenerators] P625 -23.3991,-52.0910,0.0001 + python pwb.py claimit [pagegenerators] P625 -23.3991,-52.0910,0.0001
------------------------------------------------------------------------------
By default, claimit.py does not add a claim if one with the same property already exists on the page. To override this behavior, use the 'exists' option:
-python claimit.py [pagegenerators] P246 "string example" -exists:p + python pwb.py claimit [pagegenerators] P246 "string example" -exists:p
Suppose the claim you want to add has the same property as an existing claim and the "-exists:p" argument is used. Now, claimit.py will not add the claim @@ -42,7 +42,7 @@ For instance, to add the claim to each page even if one with the same property, target, and qualifiers already exists:
-python claimit.py [pagegenerators] P246 "string example" -exists:ptq + python pwb.py claimit [pagegenerators] P246 "string example" -exists:ptq
Note that the ordering of the letters in the 'exists' argument does not matter, but 'p' must be included. diff --git a/scripts/commons_link.py b/scripts/commons_link.py index 17ed26f..c1e592b 100755 --- a/scripts/commons_link.py +++ b/scripts/commons_link.py @@ -10,7 +10,9 @@ redirect, this also functions.
Run: -Syntax: python commons_link.py [action] [pagegenerator] +Syntax: + + python pwb.py commons_link [action] [pagegenerator]
where action can be one of these: * pages : Run over articles, include {{commons}} diff --git a/scripts/commonscat.py b/scripts/commonscat.py index 2289005..bc5b35e 100755 --- a/scripts/commonscat.py +++ b/scripts/commonscat.py @@ -23,7 +23,8 @@ template.
For example to go through all categories: -commonscat.py -start:Category:! + + python pwb.py commonscat -start:Category:! """ # Commonscat bot: # diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py index e7fb94c..fdc5579 100755 --- a/scripts/coordinate_import.py +++ b/scripts/coordinate_import.py @@ -1,11 +1,12 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" Coordinate importing script.
Usage:
-python coordinate_import.py -lang:en -family:wikipedia -cat:Category:Coordinates_not_on_Wikidata + python pwb.py coordinate_import -lang:en -family:wikipedia \ + -cat:Category:Coordinates_not_on_Wikidata
This will work on all pages in the category "coordinates not on Wikidata" and will import the coordinates on these pages to Wikidata. @@ -16,13 +17,14 @@
You can use any typical pagegenerator to provide with a list of pages:
-python coordinate_import.py -lang:it -family:wikipedia -transcludes:Infobox_stazione_ferroviaria -namespace:0 + python pwb.py coordinate_import -lang:it -family:wikipedia \ + -namespace:0 -transcludes:Infobox_stazione_ferroviaria
¶ms; """ # # (C) Multichill, 2014 -# (C) Pywikibot team, 2013-2014 +# (C) Pywikibot team, 2013-2015 # # Distributed under the terms of MIT License. # diff --git a/scripts/create_categories.py b/scripts/create_categories.py index a133c80..e4b052f 100755 --- a/scripts/create_categories.py +++ b/scripts/create_categories.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" Program to batch create categories.
The program expects a generator of page titles to be used as @@ -17,12 +17,13 @@ -basename The base to be used for the new category names.
Example: -create_categories.py - -lang:commons - -family:commons - -links:User:Multichill/Wallonia - -parent:"Cultural heritage monuments in Wallonia" - -basename:"Cultural heritage monuments in" + + python pwb.py create_categories \ + -lang:commons \ + -family:commons \ + -links:User:Multichill/Wallonia \ + -parent:"Cultural heritage monuments in Wallonia" \ + -basename:"Cultural heritage monuments in"
The page 'User:Multichill/Wallonia' on commons contains page links like [[Category:Hensies]], causing this script diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py index 14faa89..64b9ab1 100755 --- a/scripts/data_ingestion.py +++ b/scripts/data_ingestion.py @@ -3,7 +3,9 @@ """ A generic bot to do data ingestion (batch uploading).
-usage: data_ingestion.py -csvdir:local_dir/ -page:config_page +usage: + + python pwb.py data_ingestion -csvdir:local_dir/ -page:config_page """ # # (C) Pywikibot team, 2013 diff --git a/scripts/delete.py b/scripts/delete.py index 0391072..d2007bc 100755 --- a/scripts/delete.py +++ b/scripts/delete.py @@ -18,13 +18,15 @@ -undelete: Actually undelete pages instead of deleting. Obviously makes sense only with -page and -file.
-Usage: python delete.py [-category categoryName] +Usage: + + python pwb.py delete [-category categoryName]
Examples:
Delete everything in the category "To delete" without prompting.
- python delete.py -cat:"To delete" -always + python pwb.py delete -cat:"To delete" -always """ # # (C) Pywikibot team, 2014 diff --git a/scripts/disambredir.py b/scripts/disambredir.py index 2d1ac32..a4b6d4b 100755 --- a/scripts/disambredir.py +++ b/scripts/disambredir.py @@ -4,7 +4,8 @@ User assisted updating redirect links on disambiguation pages.
Usage: - python disambredir.py [start] + + python pwb.py disambredir [start]
If no starting name is provided, the bot starts at '!'.
diff --git a/scripts/featured.py b/scripts/featured.py index 9e534b7..26f3756 100755 --- a/scripts/featured.py +++ b/scripts/featured.py @@ -46,7 +46,7 @@ -count Only counts how many featured/good articles exist on all wikis (given with the "-fromlang" argument) or on several language(s) (when using the "-fromall" argument). - Example: featured.py -fromlang:en,he -count + Example: python pwb.py featured -fromlang:en,he -count counts how many featured articles exist in the en and he wikipedias.
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py index c131a23..5ce0de8 100755 --- a/scripts/harvest_template.py +++ b/scripts/harvest_template.py @@ -1,12 +1,14 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" Template harvesting script.
Usage:
-* harvest_template.py -transcludes:"..." template_parameter PID [template_parameter PID] -* harvest_template.py [generators] -template:"..." template_parameter PID [template_parameter PID] +* python pwb.py harvest_template -transcludes:"..." \ + template_parameter PID [template_parameter PID] +* python pwb.py harvest_template [generators] -template:"..." \ + template_parameter PID [template_parameter PID]
This will work on all pages that transclude the template in the article namespace @@ -17,7 +19,8 @@
Examples:
-* harvest_template.py -lang:nl -cat:Sisoridae -template:"Taxobox straalvinnige" -namespace:0 orde P70 familie P71 geslacht P74 + python pwb.py harvest_template -lang:nl -cat:Sisoridae -namespace:0 \ + -template:"Taxobox straalvinnige" orde P70 familie P71 geslacht P74
""" # diff --git a/scripts/illustrate_wikidata.py b/scripts/illustrate_wikidata.py index cc1e4e2..9132e6e 100755 --- a/scripts/illustrate_wikidata.py +++ b/scripts/illustrate_wikidata.py @@ -8,7 +8,7 @@
Usage:
-python illustrate_wikidata.py <some generator> + python pwb.py illustrate_wikidata <some generator>
¶ms; """ diff --git a/scripts/image.py b/scripts/image.py index d7b61a2..3461112 100755 --- a/scripts/image.py +++ b/scripts/image.py @@ -3,7 +3,9 @@ """ This script can be used to change one image to another or remove an image.
-Syntax: python image.py image_name [new_image_name] +Syntax: + + python pwb.py image image_name [new_image_name]
If only one command-line parameter is provided then that image will be removed; if two are provided, then the first image will be replaced by the second one on @@ -27,11 +29,11 @@ The image "FlagrantCopyvio.jpg" is about to be deleted, so let's first remove it from everything that displays it:
- python image.py FlagrantCopyvio.jpg + python pwb.py image FlagrantCopyvio.jpg
The image "Flag.svg" has been uploaded, making the old "Flag.jpg" obsolete:
- python image.py Flag.jpg Flag.svg + python pwb.py image Flag.jpg Flag.svg
""" # diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py index c88d07e..98c7ed4 100755 --- a/scripts/imagetransfer.py +++ b/scripts/imagetransfer.py @@ -5,7 +5,7 @@
Syntax:
- python imagetransfer.py pagename [-interwiki] [-tolang:xx] [-tofamily:yy] + python pwb.py imagetransfer pagename [-interwiki] [-tolang:x] [-tofamily:y]
Arguments:
@@ -13,12 +13,12 @@
-keepname Keep the filename and do not verify description while replacing
- -tolang:xx Copy the image to the wiki in language xx + -tolang:x Copy the image to the wiki in language x
- -tofamily:yy Copy the image to a wiki in the family yy + -tofamily:y Copy the image to a wiki in the family y
- -file:zz Upload many files from textfile: [[Image:xx]] - [[Image:yy]] + -file:z Upload many files from textfile: [[Image:x]] + [[Image:y]]
If pagename is an image description page, offers to copy the image to the target site. If it is a normal page, it will offer to copy any of the images diff --git a/scripts/lonelypages.py b/scripts/lonelypages.py index d3ec6e4..de4e7ca 100755 --- a/scripts/lonelypages.py +++ b/scripts/lonelypages.py @@ -28,7 +28,8 @@
--- Examples --- -python lonelypages.py -enable:User:Bot/CheckBot -always + + python pwb.py lonelypages -enable:User:Bot/CheckBot -always """ # # (C) Pietrodn, it.wiki 2006-2007 diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py index f05e9fd..7669f17 100755 --- a/scripts/maintenance/cache.py +++ b/scripts/maintenance/cache.py @@ -3,7 +3,9 @@ r""" This script runs commands on each entry in the API caches.
-Syntax: cache.py [-password] [-delete] [-c '...'] [dir ...] +Syntax: + + python pwb.py cache [-password] [-delete] [-c "..."] [dir ...]
If no directory are specified, it will detect the API caches.
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py index fb9ef6c..e19f98c 100755 --- a/scripts/maintenance/compat2core.py +++ b/scripts/maintenance/compat2core.py @@ -17,10 +17,12 @@ usage
to convert a script and show warnings about deprecated methods: - pwb.py maintenance/compat2core <scriptname> + + python pwb.py maintenance/compat2core <scriptname>
to show warnings about deprecated methods: - pwb.py maintenance/compat2core <scriptname> -warnonly + + python pwb.py maintenance/compat2core <scriptname> -warnonly """ # # (C) xqt, 2014 diff --git a/scripts/match_images.py b/scripts/match_images.py index d74b715..56f58c1 100755 --- a/scripts/match_images.py +++ b/scripts/match_images.py @@ -4,9 +4,10 @@ Program to match two images based on histograms.
Usage: -match_images.py ImageA ImageB + + python pwb.py match_images ImageA ImageB + It is essential to provide two images to work on. -example. - match_images.py ImageA.jpg ImageB.jpg
¶ms;
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py index b462ec7..b5eeae8 100755 --- a/scripts/nowcommons.py +++ b/scripts/nowcommons.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" Script to delete files that are also present on Wikimedia Commons.
Do not run this script on Wikimedia Commons itself. It works based on @@ -39,7 +39,9 @@ the user to check if the images are equal or not.
-- Example -- -python nowcommons.py -replaceonly -hash -replace -replaceloose -replacealways + + python pwb.py nowcommons -replaceonly -replaceloose -replacealways \ + -replace -hash
-- Known issues -- Please fix these if you are capable and motivated: diff --git a/scripts/piper.py b/scripts/piper.py index a7af13d..64c1a36 100755 --- a/scripts/piper.py +++ b/scripts/piper.py @@ -1,17 +1,18 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" This bot uses external filtering programs for munging text.
For example:
- python pwb.py piper.py -filter:'tr A-Z a-z' -page:Wikipedia:Sandbox + python pwb.py piper -filter:"tr A-Z a-z" -page:Wikipedia:Sandbox
Would lower case the article with tr(1).
Muliple -filter commands can be specified:
- python pwb.py piper.py -filter:cat -filter:'tr A-Z a-z' -filter:'tr a-z A-Z' -page:Wikipedia:Sandbox + python pwb.py piper -filter:cat -filter:"tr A-Z a-z" -filter:"tr a-z A-Z" \ + -page:Wikipedia:Sandbox
Would pipe the article text through cat(1) (NOOP) and then lower case diff --git a/scripts/protect.py b/scripts/protect.py index 750c1cf..34e8b8d 100755 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -35,10 +35,12 @@ Examples:
Protect everything in the category 'To protect' prompting. - python protect.py -cat:'To protect' + + python pwb.py protect -cat:"To protect"
Unprotect all pages listed in text file 'unprotect.txt' without prompting. - python protect.py -file:unprotect.txt -unprotect -always + + python pwb.py protect -file:unprotect.txt -unprotect -always """ # # Written by https://it.wikisource.org/wiki/Utente:Qualc1 diff --git a/scripts/redirect.py b/scripts/redirect.py index e2b53ad..7251548 100755 --- a/scripts/redirect.py +++ b/scripts/redirect.py @@ -8,7 +8,7 @@
Syntax:
- python redirect.py action [-arguments ...] + python pwb.py redirect action [-arguments ...]
where action can be one of these:
diff --git a/scripts/replace.py b/scripts/replace.py index 31188d8..190fcf8 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -74,7 +74,7 @@
-replacementfile Lines from the given file name(s) will be read as replacement arguments. i.e. a file containing lines "a" and "b", used as - python replace.py -page:X -replacementfile:file c d + python pwb.py replace -page:X -replacementfile:file c d will replace 'a' with 'b' and 'c' with 'd'.
-always Don't prompt you for each replacement @@ -100,24 +100,26 @@ new syntax, e.g. {{Stub}}, download an XML dump file (pages-articles) from https://download.wikimedia.org, then use this command:
- python replace.py -xml -regex "{{msg:(.*?)}}" "{{\1}}" + python pwb.py replace -xml -regex "{{msg:(.*?)}}" "{{\1}}"
If you have a dump called foobar.xml and want to fix typos in articles, e.g. Errror -> Error, use this:
- python replace.py -xml:foobar.xml "Errror" "Error" -namespace:0 + python pwb.py replace -xml:foobar.xml "Errror" "Error" -namespace:0
If you want to do more than one replacement at a time, use this: - python replace.py -xml:foobar.xml "Errror" "Error" "Faail" "Fail" -namespace:0 + + python pwb.py replace -xml:foobar.xml "Errror" "Error" "Faail" "Fail" \ + -namespace:0
If you have a page called 'John Doe' and want to fix the format of ISBNs, use:
- python replace.py -page:John_Doe -fix:isbn + python pwb.py replace -page:John_Doe -fix:isbn
This command will change 'referer' to 'referrer', but not in pages which talk about HTTP, where the typo has become part of the standard:
- python replace.py referer referrer -file:typos.txt -excepttext:HTTP + python pwb.py replace referer referrer -file:typos.txt -excepttext:HTTP
Please type "replace.py -help | more" if you can't read the top of the help. """ diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py index 788f993..538c439 100755 --- a/scripts/replicate_wiki.py +++ b/scripts/replicate_wiki.py @@ -4,7 +4,8 @@ This bot replicates pages in a wiki to a second wiki within one family.
Example: -python replicate_wiki.py [-r] -ns 10 -f wikipedia -o nl li fy + + python pwb.py replicate_wiki [-r] -ns 10 -f wikipedia -o nl li fy
to copy all templates from an nlwiki to liwiki and fywiki. It will show which pages have to be changed if -r is not present, and will only actually write diff --git a/scripts/script_wui.py b/scripts/script_wui.py index aa87b53..91716b4 100755 --- a/scripts/script_wui.py +++ b/scripts/script_wui.py @@ -18,7 +18,8 @@ All other parameters will be ignored.
Syntax example: - python script_wui.py -dir:. + + python pwb.py script_wui -dir:. Default operating mode. """ # @package script_wui diff --git a/scripts/shell.py b/scripts/shell.py index a5de43b..d5f0e3f 100755 --- a/scripts/shell.py +++ b/scripts/shell.py @@ -4,6 +4,7 @@ Spawns an interactive Python shell.
Usage: + python pwb.py shell [args]
If no arguments are given, the pywikibot library will not be loaded. diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py index 447f012..9949a9f 100755 --- a/scripts/solve_disambiguation.py +++ b/scripts/solve_disambiguation.py @@ -63,7 +63,7 @@
To complete a move of a page, one can use:
- python solve_disambiguation.py -just -pos:New_Name Old_Name + python pwb.py solve_disambiguation -just -pos:New_Name Old_Name
""" # diff --git a/scripts/spamremove.py b/scripts/spamremove.py index c728e9b..8350d70 100755 --- a/scripts/spamremove.py +++ b/scripts/spamremove.py @@ -5,7 +5,7 @@
Usage:
-spamremove.py www.spammedsite.com + python pwb.py spamremove www.spammedsite.com
It will use Special:Linksearch to find the pages on the wiki that link to that site, then for each page make a proposed change consisting of removing diff --git a/scripts/template.py b/scripts/template.py index 3cec5d9..ff6ab1d 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" Very simple script to replace a template with another one.
It also converts the old MediaWiki boilerplate format to the new format. @@ -60,7 +60,7 @@ If you have a template called [[Template:Cities in Washington]] and want to change it to [[Template:Cities in Washington state]], start
- python template.py "Cities in Washington" "Cities in Washington state" + python pwb.py template "Cities in Washington" "Cities in Washington state"
Move the page [[Template:Cities in Washington]] manually afterwards.
@@ -68,7 +68,7 @@ If you have a template called [[Template:test]] and want to substitute it only on pages in the User: and User talk: namespaces, do:
- python template.py test -subst -namespace:2 -namespace:3 + python pwb.py template test -subst -namespace:2 -namespace:3
Note that -namespace: is a global Pywikibot parameter
@@ -77,24 +77,26 @@ It only performs substitutions in main article namespace and doesn't prompt to start replacing. Note that -putthrottle: is a global Pywikibot parameter.
- python template.py -putthrottle:30 -namespace:0 lived -subst -always + python pwb.py template -putthrottle:30 -namespace:0 lived -subst -always \ -summary:"BOT: Substituting {{lived}}, see [[WP:SUBST]]."
This next example removes the templates {{cfr}}, {{cfru}}, and {{cfr-speedy}} from five category pages as given:
- python template.py cfr cfru cfr-speedy -remove -always - -page:"Category:Mountain monuments and memorials" -page:"Category:Indian family names" - -page:"Category:Tennis tournaments in Belgium" -page:"Category:Tennis tournaments in Germany" - -page:"Category:Episcopal cathedrals in the United States" + python pwb.py template cfr cfru cfr-speedy -remove -always \ + -page:"Category:Mountain monuments and memorials" \ + -page:"Category:Indian family names" \ + -page:"Category:Tennis tournaments in Belgium" \ + -page:"Category:Tennis tournaments in Germany" \ + -page:"Category:Episcopal cathedrals in the United States" \ -summary:"Removing Cfd templates from category pages that survived."
This next example substitutes templates test1, test2, and space test on all pages:
- python template.py test1 test2 "space test" -subst -always + python pwb.py template test1 test2 "space test" -subst -always
""" # diff --git a/scripts/templatecount.py b/scripts/templatecount.py index f875627..ff237b1 100755 --- a/scripts/templatecount.py +++ b/scripts/templatecount.py @@ -23,11 +23,11 @@
Counts how many times {{ref}} and {{note}} are transcluded in articles:
- templatecount.py -count -namespace:0 ref note + python pwb.py templatecount -count -namespace:0 ref note
Lists all the category pages that transclude {{cfd}} and {{cfdu}}:
- templatecount.py -list -namespace:14 cfd cfdu + python pwb.py templatecount -list -namespace:14 cfd cfdu
""" # diff --git a/scripts/transferbot.py b/scripts/transferbot.py index 239a991..2b587d7 100755 --- a/scripts/transferbot.py +++ b/scripts/transferbot.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -""" +r""" This script transfers pages from a source wiki to a target wiki.
It also copies edit history to a subpage. @@ -22,17 +22,21 @@
Example commands:
-# Transfer all pages in category "Query service" from the Toolserver wiki to -# wikitech, adding Nova_Resource:Tools/Tools/ as prefix -transferbot.py -v -family:toolserver -tofamily:wikitech -cat:"Query service" -prefix:Nova_Resource:Tools/Tools/ +Transfer all pages in category "Query service" from the English Wikipedia to the +Arabic Wiktionary, adding "Wiktionary:Import enwp/" as prefix:
-# Copy the template "Query service" from the Toolserver wiki to wikitech -transferbot.py -v -family:toolserver -tofamily:wikitech -page:"Template:Query service" + python pwb.py transferbot -family:wikipedia -lang:en -cat:"Query service" \ + -tofamily:wiktionary -tolang:ar -prefix:"Wiktionary:Import enwp/" + +Copy the template "Query service" from the Toolserver wiki to wikitech: + + python pwb.py transferbot -family:wikipedia -lang:en \ + -tofamily:wiktionary -tolang:ar -page:"Template:Query service"
""" # # (C) Merlijn van Deen, 2014 -# (C) Pywikibot team, 2014 +# (C) Pywikibot team, 2015 # # Distributed under the terms of the MIT license. # diff --git a/scripts/unlink.py b/scripts/unlink.py index 6672217..4460fc4 100755 --- a/scripts/unlink.py +++ b/scripts/unlink.py @@ -16,9 +16,8 @@
Example:
-python unlink.py "Foo bar" -namespace:0 -namespace:6 - - Removes links to the page [[Foo bar]] in articles and image descriptions. + python pwb.py unlink "Foo bar" -namespace:0 -namespace:6 + Removes links to the page [[Foo bar]] in articles and image descriptions. """ # # (C) Pywikibot team, 2007-2015 diff --git a/scripts/watchlist.py b/scripts/watchlist.py index f3a0a76..245988d 100755 --- a/scripts/watchlist.py +++ b/scripts/watchlist.py @@ -8,7 +8,9 @@ watchlist can be updated manually by running this script. The list will also be reloaded automatically once a month.
-Syntax: python watchlist [-all | -new] +Syntax: + + python pwb.py watchlist [-all | -new]
Command line options: -all - Reloads watchlists for all wikis where a watchlist is already diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py index e3c8caf..5746ae8 100755 --- a/scripts/weblinkchecker.py +++ b/scripts/weblinkchecker.py @@ -72,21 +72,21 @@ times during a timespan of at least one week.
Syntax examples: - python weblinkchecker.py -start:! + python pwb.py weblinkchecker -start:! Loads all wiki pages in alphabetical order using the Special:Allpages feature.
- python weblinkchecker.py -start:Example_page + python pwb.py weblinkchecker -start:Example_page Loads all wiki pages using the Special:Allpages feature, starting at "Example page"
- python weblinkchecker.py -weblink:www.example.org + python pwb.py weblinkchecker -weblink:www.example.org Loads all wiki pages that link to www.example.org
- python weblinkchecker.py Example page + python pwb.py weblinkchecker Example page Only checks links found in the wiki page "Example page"
- python weblinkchecker.py -repeat + python pwb.py weblinkchecker -repeat Loads all wiki pages where dead links were found during a prior run """ #
pywikibot-commits@lists.wikimedia.org