[Pywikipedia-l] Command line parameter autocompletion

Tisza Gergo gtisza at gmail.com
Fri Dec 16 12:14:40 UTC 2011


Hi bot people,

did anyone try creating command line autocompletion [1] for bot scripts? We are
setting up a sort of toolserver for the bot owners on Hungarian Wikipedia, and
trying to make it a comfortable environment, and parameter autocompletion would
be a big step towards that.

I'm interested both in quick and dirty hacks (my current plan is to grep out the
arg.startswith parameters from the bot code and use them as a more or less
correct argument list) and a long-term solution for making pywikipediabot
parameter handling and help generation easy both for the bot programmer and the
bot user. I'm thinking along the lines of defining a list of options, with a
couple field for each options: short name, long name(s), help text, whether it
takes an option (a bit like getopts in Linux, just with cleaner syntax). Some
helper function would then process the command line based on that, and the bot
programmer would just have to iterate trough the results, without all the ugly
string manipulation that is currently required. This would have several 
advantages:
- easier parameter handling and help text autogeneration
- automatic generation of bash completion files
- it could pave the way for moving towards a more linux-like command syntax with
double dashes before long arguments and the other usual features
- it would make it possible to create GUI controls for the bots, with
auto-generated option fields

What do you think about it? Am I overcomplicating, or reinventing the wheel, or
is this worth doing?


[1] https://www.gnu.org/software/bash/manual/bashref.html#Programmable-Completion




More information about the Pywikipedia-l mailing list