Hello, pywikibot doesn't use standard arguments and argument parsing For example a standard input should be like this: python pwb.py replace "something" "something else" --page="python" --always or python pwb.py replace "something" "something else" --p "python" -a
And in back-end, pywikibot uses sysargv for parsing args but it's discouraged and it's better to use argparse https://docs.python.org/2/library/argparse.html .
I made some changes in bot.py in function handlearg https://gerrit.wikimedia.org/r/156089
Still needs lots of work but before I go on I want your opinion about this change. Best
On 25 August 2014 13:00, Amir Ladsgroup ladsgroup@gmail.com wrote:
Hello, pywikibot doesn't use standard arguments and argument parsing
It doesn't do what /unix/ considers standard. However, we use the same system as e.g. rar and zip.
What's the advantage of switching to a new system that will force every user to re-learn the commands to use?
Merlijn
No, zip http://linux.about.com/od/commands/a/blcmdl1_zipx.htm and rar http://comptb.cects.com/using-the-winrar-command-line-tools-in-windows/ both use standard system (note that -r is standard, -
*recurse is not) * About the leaning system, I think we can keep compatibility for a while and start deprecate them then. and It's easier to use -p instead of -page ;)
Best
On Mon, Aug 25, 2014 at 3:39 PM, Merlijn van Deen valhallasw@arctus.nl wrote:
On 25 August 2014 13:00, Amir Ladsgroup ladsgroup@gmail.com wrote:
Hello, pywikibot doesn't use standard arguments and argument parsing
It doesn't do what /unix/ considers standard. However, we use the same system as e.g. rar and zip.
What's the advantage of switching to a new system that will force every user to re-learn the commands to use?
Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
On 25 August 2014 13:50, Amir Ladsgroup ladsgroup@gmail.com wrote:
No, zip http://linux.about.com/od/commands/a/blcmdl1_zipx.htm and rar http://comptb.cects.com/using-the-winrar-command-line-tools-in-windows/ both use standard system (note that -r is standard, - *recurse is not) *
No, they don't (but I was also wrong in saying we use the same system they do). Zip has a concept of 'short' and 'long' options, but not in the same sense unix programs do. For zip -dc is very different than zip -d -c, while in the unix way, la -la is equivalent to ls -l -a.
Rar doesn't have a concept of 'long' options - it has various lengths of options, all starting with a single dash, /and/ commands that do not take a dash.
About the leaning system, I think we can keep compatibility for a while and
start deprecate them then. and It's easier to use -p instead of -page ;)
Is it? Or is it instead of -prefixindex? Or instead of -put_throttle? And even if it were easier to use, I don't find that a very convincing argument to force people to change their habits.
Merlijn
Let me just chime in here as someone who recently started using pywikibot.
I was very confused by the argument passing style, especially the use of a colon to delimit the name of the argument from its value. I questioned why it was like this and thought about how it would be nicer if it followed standard UNIX practice.
However, thinking rationally about this, there are a number of existing users and existing scripts which call pywikibot with the arguments the way they are. Forcing a migration is not feasible. And maintaining two separate methodologies for passing arguments is likely to introduce risk and bugs, without much benefit (since those who already pass the arguments the current way will just keep on doing so).
Thanks, -Travis
On 25 August 2014 12:14, Merlijn van Deen valhallasw@arctus.nl wrote:
On 25 August 2014 13:50, Amir Ladsgroup ladsgroup@gmail.com wrote:
No, zip http://linux.about.com/od/commands/a/blcmdl1_zipx.htm and rar http://comptb.cects.com/using-the-winrar-command-line-tools-in-windows/ both use standard system (note that -r is standard, - *recurse is not) *
No, they don't (but I was also wrong in saying we use the same system they do). Zip has a concept of 'short' and 'long' options, but not in the same sense unix programs do. For zip -dc is very different than zip -d -c, while in the unix way, la -la is equivalent to ls -l -a.
Rar doesn't have a concept of 'long' options - it has various lengths of options, all starting with a single dash, /and/ commands that do not take a dash.
About the leaning system, I think we can keep compatibility for a while
and start deprecate them then. and It's easier to use -p instead of -page ;)
Is it? Or is it instead of -prefixindex? Or instead of -put_throttle? And even if it were easier to use, I don't find that a very convincing argument to force people to change their habits.
Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
On 8/25/14, Merlijn van Deen valhallasw@arctus.nl wrote:
On 25 August 2014 13:50, Amir Ladsgroup ladsgroup@gmail.com wrote:
No, zip http://linux.about.com/od/commands/a/blcmdl1_zipx.htm and rar http://comptb.cects.com/using-the-winrar-command-line-tools-in-windows/ both use standard system (note that -r is standard, - *recurse is not) *
No, they don't (but I was also wrong in saying we use the same system they do). Zip has a concept of 'short' and 'long' options, but not in the same sense unix programs do. For zip -dc is very different than zip -d -c, while in the unix way, la -la is equivalent to ls -l -a.
Rar doesn't have a concept of 'long' options - it has various lengths of options, all starting with a single dash, /and/ commands that do not take a dash.
About the leaning system, I think we can keep compatibility for a while and
start deprecate them then. and It's easier to use -p instead of -page ;)
Is it? Or is it instead of -prefixindex? Or instead of -put_throttle? And even if it were easier to use, I don't find that a very convincing argument to force people to change their habits.
prefixindex can be -pi and -putthrottle already is using -pt as an easier option. My main proposal is that we start to accept -p and --page for a while and after like one year we start to deprecate -page. No matter what we want to follow, we need to standardize our argument parsing system (using argparse).
Merlijn
Best
2014-08-26 16:39 GMT+03:00 Amir Ladsgroup ladsgroup@gmail.com:
My main proposal is that we start to accept -p and --page for a while and after like one year we start to deprecate -page.
No really acceptable now (or ever). I'm with Travis here. As weird as they might look for linux users, giving up the current parameters seems too confusing for non-technical users. Let's not become a second WMF!
No matter what we want to follow, we need to standardize our argument parsing system (using argparse).
Does that mean giving up on the ':'?
Strainu
Merlijn
Best
Amir
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
No, We can replace first ":" in arguments to "=" and feed them to argprase afterwards so no change in user-frontend (and supporting more ways to work with pywikibot)
Best
On 8/26/14, Strainu strainu10@gmail.com wrote:
2014-08-26 16:39 GMT+03:00 Amir Ladsgroup ladsgroup@gmail.com:
My main proposal is that we start to accept -p and --page for a while and after like one year we start to deprecate -page.
No really acceptable now (or ever). I'm with Travis here. As weird as they might look for linux users, giving up the current parameters seems too confusing for non-technical users. Let's not become a second WMF!
No matter what we want to follow, we need to standardize our argument parsing system (using argparse).
Does that mean giving up on the ':'?
Strainu
Merlijn
Best
Amir
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
pywikipedia-l@lists.wikimedia.org