subcommand Questions
10
Solved
How can I have a default sub-command, or handle the case where no sub-command is given using argparse?
import argparse
a = argparse.ArgumentParser()
b = a.add_subparsers()
b.add_parser('hi')
a.pa...
Atlantean asked 15/6, 2011 at 23:24
4
Solved
Implementing "nested" subcommands in Python with cmdln.
I'm not sure I'm using the right terminology here. I'm trying to implement a commandline tool using cmdln that allows for "nested" subcomman...
Daisie asked 14/12, 2011 at 21:56
4
I know that this question has been asked already, but I'm looking for Java cli parser with a specific functionality.
I want it to be able to define command line tree, thus using subcommands (and mo...
Bonin asked 15/4, 2012 at 6:41
4
Solved
I'm working with argparse and am trying to mix sub-commands and positional arguments, and the following issue came up.
This code runs fine:
import argparse
parser = argparse.ArgumentParser()
subp...
Orvil asked 29/12, 2011 at 13:35
7
Solved
I have the following code (using Python 2.7):
# shared command line options, like --version or --verbose
parser_shared = argparse.ArgumentParser(add_help=False)
parser_shared.add_argument('--versi...
Lithia asked 15/12, 2011 at 14:27
2
Solved
I need to implement a command line interface in which the program accepts subcommands.
For example, if the program is called “foo”, the CLI would look like
foo cmd1 <cmd1-options>
foo cmd2
...
Pontic asked 6/10, 2014 at 13:5
2
Solved
I'm trying to figure out how to use argparser to do the following:
$ python test.py executeBuild --name foobar1 executeBuild --name foobar2 ....
getBuild itself is a sub-command. My goal is to h...
Sofer asked 30/6, 2014 at 6:24
5
Solved
argparse fails at dealing with sub-commands receiving global options:
import argparse
p = argparse.ArgumentParser()
p.add_argument('--arg', action='store_true')
s = p.add_subparsers()
s.add_parser...
Copyreader asked 5/6, 2012 at 11:8
1
Solved
Is it possible to implement sub-commands for bash scripts. I have something like this in mind:
http://docs.python.org/dev/library/argparse.html#sub-commands
Shampoo asked 30/11, 2012 at 2:41
1
© 2022 - 2024 — McMap. All rights reserved.