Docopt - one ore more options are required -
I have three arguments: - a - b - c and I want to at least accept commands on them but All combinations of A / B / C are also valid. Example:
command.py --a command.py --a --b - command - py - a - b - c ... But without logic:
Thanks!
I want to accept at least the command on these < / Blockquote>
You can do the following:
& gt; & Gt; & Gt; Docop import from Docopat & gt; & Gt; & Gt; U = '' 'Usage: command.py - A [--b --c] ... command.py --b [--a --c] ... command.py - c [- A - B ] '' '& Gt; & Gt; & Gt; Document (U, ['-a']) {'- A': True, '-b': false, '-': false}> gt; & Gt; & Gt; Dococort (U, ['- B']) {'- A': false, '-b': true, '-c': false}> gt; & Gt; & Gt; Dococort (U, ['-' ']) {' - A ': false,' - B ': false,' - ': true}> gt; & Gt; Docopt (u, []) Usage: command.py - A [--b --c] command.py --b [--a --c] command.py - c [--a --b]] However this may not be the most user-friendly command-line interface. Maybe, you can explain your interface in more detail, and I can advise how to implement it (probably not only with options, but also order and positional arguments).
Comments
Post a Comment