This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Christophe.Guillon
Recipients Christophe.Guillon, amcnabb, andersk, bethard, davidben, drm, eric.araujo, eric.smith, gdb, nelhage, r.david.murray, skilletaudio
Date 2012-09-02.17:58:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346608725.55.0.443462171772.issue9334@psf.upfronthosting.co.za>
In-reply-to
Content
As a workaround for this missing feature,
the negative number matching regexp can be used for allowing arguments starting with '-' in arguments of option flags.

We basically do:
parser = argparse.ArgumentParser(...)
parser._negative_number_matcher = re.compile(r'^-.+$')

This allow cases such as @andersk:
$ a2x --asciidoc-opts --safe gitcli.txt
where '--safe' is an argument to '--asciidoc-opts'

As this behavioral change is quite simple, couldn't the requested feature be implemented like this with an optional setting to the ArgumentParser contructor?
History
Date User Action Args
2012-09-02 17:58:45Christophe.Guillonsetrecipients: + Christophe.Guillon, amcnabb, bethard, eric.smith, eric.araujo, r.david.murray, andersk, gdb, nelhage, drm, davidben, skilletaudio
2012-09-02 17:58:45Christophe.Guillonsetmessageid: <1346608725.55.0.443462171772.issue9334@psf.upfronthosting.co.za>
2012-09-02 17:58:45Christophe.Guillonlinkissue9334 messages
2012-09-02 17:58:44Christophe.Guilloncreate