I'm writing my first python command line tool using docopt and have run into an issue.
My structure is like this:
Usage:
my-tool configure
my-tool [(-o <option> | --option <option>)]
...
I'm trying to find a way to run my-tool -o foo-bar
first, and then optionally pass the value 'foo-bar' into my configure function if I run my-tool configure
next.
In pseduocode, that translates to this:
def configure(option=None):
print option # With the above inputs this should print 'foo-bar'
def main():
if arguments['configure']:
configure(option=arguments['<option>'])
return
...
Is there a way to get this working without changing the argument structure?
I'm looking for a way to avoid my-tool configure [(-o <option> | --option <option>)]