Questions tagged [subcommand]

Use this tag for questions related to subcommands, i.e. commands inside a routine.

Subcommands make it possible for you to group related command line functionality under one root command.

Examples of subcommands are install in apt-get install and push in git push.

Users tend to use this tag for questions related to existing subcommands, or subcommands that are an artifact of the users itselves. Last but not least, questions that handle subcommand arguments, for example in a Python program, are also suitable for this tag.

38 questions
0
votes
1 answer

Command-line argument overwritten by default value when using subparser

I have a program with sub commands, but they all have common arguments (e.g. they all require input and output directories) which I included in the parent parser to avoid redundancies. However, I want each subcommand to have a different default…
0
votes
0 answers

Default value for a subparser option (Python argparse)

My program boiler uses argparse for parsing command line options and subparser chain (in fact, I am going to add more subcommands). It should take the option -t both for the main option parser and for the subparser. Example: boiler -t URL chain is…
porton
  • 5,214
  • 11
  • 47
  • 95
0
votes
0 answers

Can I add a ArgumentParser to parse a subcommand?

For my toy project mpu I want to have the following commands: # Creates a Python project based on a template $ mpu init # Checks a Python project for style $ mpu stylecheck So let's say I have a command run_init() and a command run_stylecheck()…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0
votes
0 answers

Dividing large program into subcommands with argparse

I want to use six subcommands (using subparsers from the argparse library) to divide my large program into smaller independent programs, and be able to run them individually. In other words, I envision running six commands from the command line one…
John Smith
  • 393
  • 1
  • 6
  • 17
0
votes
1 answer

Optional parameters to arguments along with sub commands using argparse

I'm having trouble trying to allow for optional test parameters to be inserted into CLI I'm created. Here's what I've able to do: python test.py --test build --name foobar Where build is a subcommand, and --test allows for the system to point to…
Avaclon
  • 163
  • 6
0
votes
3 answers

How are subcommands used in Tcl/Tk?

Reading this entry in the Tcl/Tk online reference i came across this paragraph where it states: The combobox widget also supports the following ttk::entry widget subcommands (see ttk::entry(n) for…
Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199
-1
votes
1 answer

argparse solution requested for commands and subcommands with subcommands

Hopefully this will translate into an elegant solution, but i am unable to figure it out myself. I have been reading huge amounts of examples and explanations but I cant seem to get it to work. I am writing a program that needs the following…
FrankIJ
  • 1,987
  • 1
  • 10
  • 11
-1
votes
2 answers

Edit executavble command to make random number generator in Perl

I was using this module for Perl, Crypt::PRNG, to generate random numbers. The number-generation seems truly random when using the random string command, it can use digits 0-9 as well as other characters and create a random string of the specified…
J. Linne
  • 275
  • 4
  • 15
1 2
3