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
1
vote
0 answers

Python Click - pass configuration file to supply both subcommands and options

I am trying to construct a Click MultiCommand group such that I'm able to supply a combination of options, subcommands and subcommand options, both from the commandline and from a configuration file. There are a few examples of driving Click from a…
ross-g
  • 105
  • 6
1
vote
1 answer

execute a subcommand in a different directory as the current one in fish?

I want to move a file from a directory different from the current directory. This is the solution I thought of: mv (cd ~/Downloads; ls -t | head -1 | xargs -I {} readlink -f {}) ./ There is probably a better way, but along the way I found that my…
honestSalami
  • 247
  • 1
  • 6
1
vote
1 answer

How to have a specific sub-command require flag with argparse?

so I am writing a python script that uses argparse in order to pass information and process input. I have been using sub-commands to force/use different operations in the program. So far my script is formatted like so: #!/usr/bin/env python3 # -*-…
Rietty
  • 1,116
  • 9
  • 24
1
vote
1 answer

Using cmd module: how to have sub-commands documented in `help` and integrated with autocomplete?

I'm using the cmd module and have a command called server (method do_server()) which has autocomplete out of the box (I'm on macOS). That's all fine and works like expected. But if i want to additionally also use a sub-command on the server command,…
Endogen
  • 589
  • 2
  • 12
  • 24
1
vote
1 answer

Command output printed instead of captured in Powershell

In general, I know how to capture the output of a command into a variable in Powershell: > $output = python3 --version > Write-Host $output Python 3.7.0 Python 3 prints its version but it's captured into the variable $output and nothing is…
David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
1
vote
1 answer

Argparse: parse multiple subcommands

Did some research, but couldn't find any working solution. I'm trying to parse the following command line, where 'test' and 'train' are two independent subcommands each having distinct arguments: ./foo.py train -a 1 -b 2 ./foo.py test -a 3 -c…
memecs
  • 7,196
  • 7
  • 34
  • 49
0
votes
2 answers

Sub-command doesn't been reconize by system

In my package.json, I have this scripts: "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "build-dev": "nodemon -e ts,html -w ./src -x 'npm run build && gulp dist'", "watch": "ng build --watch --configuration…
Rumike7
  • 21
  • 3
0
votes
1 answer

How to code sub commands for discord.py but they are slash commands and in a cog file

So I am making a sub command group named set. Then the commands that are in that group are, profile, introduction, birthday etc. These commands should be slash commands (interaction commands) But I cannot figure out how to do this. I've tried this…
0
votes
0 answers

How can I do Variable Importance Charts by the Cluster in SPSS?

Does anybody know how to do Variable Importance Charts in SPSS? I want mine to look pretty much like- https://i.stack.imgur.com/buZG3.png Meanwhile, the best version of what I can get it to look like the output above is this-…
0
votes
1 answer

click sub command question: failed to test sub-command

Hi: I'm new to click and here is a example of how I failed to test my sub-command: for some reasons I need to keep my python environment clean and I created a virtual environment to install click in "venv/lib/" main.py import…
xwei
  • 9
  • 1
0
votes
0 answers

Mixture of sub-command and root arguments in Argument Parser

Here are two possible ways to run a Python program with arguments python ./main.py setup-queues or python ./main.py -n 2 -i 1 If the sub-command setup-queues is not given, root arguments -n & -i must be provided. On the other hand, setup-queues…
hunterex
  • 565
  • 11
  • 27
0
votes
0 answers

How do you create subcommands with argparse using subparsers when the subcommands have different arguments?

There are similar solutions here, but they either deal with much older versions of python, or deal only with parsers but not subparsers. I am writing a program with a simple command line interface. I would like the script to have subcommands. The…
Derek1st
  • 63
  • 6
0
votes
1 answer

How do you install subcommands?

I am getting the following error message in Go v. 1.15.8 darwin/amd64 main.go:8:2: cannot find package "github.com/google/subcommands" in any of: /usr/local/go/src/github.com/google/subcommands (from…
user1068636
  • 1,871
  • 7
  • 33
  • 57
0
votes
0 answers

Python argparse order for sub-command and defaults values

I have been struggling with it for a long time, so I would like to do sub-commands for another command which will be ignore order opposite to subparsers = parser.add_subparsers(), because a subparser can be executed at the end of arguments or if it…
onieks
  • 51
  • 1
  • 5
0
votes
1 answer

How to pass arg from command to subcommand Discord py

Say I have the following command and subcommands: @commands.group() async def channel(self, ctx, channel_name_or_id): # convert channel_name_or_id to channel object @channel.command() async def get_mention(ctx, channel_object): await…
CircuitSacul
  • 1,594
  • 12
  • 32