There's an undocumented feature, nargs=argparse.REMAINDER, that you could use:
parser = argparse.ArgumentParser()
parser.add_argument('command')
parser.add_argument('rest', nargs=argparse.REMAINDER)
That should result in:
"frontend -h" -> calls top level parser help
"frontent blah -h" -> results in Namespace(command=blah, rest=['-h'])
This feature is not a public API at the moment, but it could become
one if someone had the time to write some tests for it and document it
appropriately.
Steve
--
Where did you get that preposterous hypothesis?
Did Steve tell you that?
--- The Hiphopopotamus
That's exactly what I needed, thanks!
> This feature is not a public API at the moment, but it could become
> one if someone had the time to write some tests for it and document it
> appropriately.
Will give a look at the coding style of the tests and if I can get to
understand how to write them I'll try to come up with something. In the
end argparse gave such a boost to my productivity I can well spend some
time giving something back :-)
Cheers
G