RFE: port command line parsing to something sane

Bug #79215 reported by Daniel Holbach
6
Affects Status Importance Assigned to Milestone
Bug Helper
Fix Released
Medium
Unassigned

Bug Description

The command line parsing in ./bugHelper/commandLine.py is pretty naïve at the moment. We need to port it to something sane to make the code maintainable.

Things we can investigate:
 - native python support for doing that
 - glib python bindings (think GOption in C)
 - something else.

Tags: commandline
Changed in bughelper:
importance: Undecided → Medium
Changed in bughelper:
status: Unconfirmed → Confirmed
Revision history for this message
Diogo Matsubara (matsubara) wrote :

Hello Daniel,

we use optparse for some scripts in Launchpad and it works really well.

http://docs.python.org/lib/module-optparse.html

Hope that helps.

Revision history for this message
Fernando Ribeiro (ipsec) wrote :

I'm rewriting to use optparse now.

Revision history for this message
Fernando Ribeiro (ipsec) wrote :

First patch using optparse.

Can somebody to test it?
It have new options (use --help for verbose).

Revision history for this message
Fernando Ribeiro (ipsec) wrote :

new patch without binary and backup =)

Revision history for this message
Daniel Holbach (dholbach) wrote :

Thanks a lot Fernando: awesome work. I committed a modified version to ~dholbach/bughelper/bughelper.dev - please everybody test and check.

Some minor nitpicks:
 - please use an indentation level of 4 spaces (PEP-8 wants that too and we use it throughout)
 - please makes lines only max. 79 chars long
 - I added your name to the contributors list instead of adding it to the header file and also mentioned you in the commit log - I hope that's ok for you
 - and also changed the variable names in a few places to make it more consistent

One change I committed with this change is Sébastien's request to drop the '-a' option. We do '--all' pages by default now.

(The command line options changed in a few places as well - please take care of that in the documentation - Alex Muntada?)

Thanks again Fernando - nice work.

Changed in bughelper:
status: Confirmed → Fix Committed
Revision history for this message
Dean Sas (dsas) wrote :

Reviewed and merged, thanks again Fernando and dholbach

Changed in bughelper:
status: Fix Committed → Fix Released
Revision history for this message
Alex Muntada (alex.muntada) wrote :

Man pages in ~alex.muntada/bughelper/bughelper.dev are up to date with Fernando's changes. The README and wiki pages aren't yet, but that's part of bug 79222.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.