Is it possible to have a default subcommand of a subcommand? #325
Answered
by
DannyBen
halostatue
asked this question in
Q&A
-
I’m working on a command that looks something like this:
That is, if |
Beta Was this translation helpful? Give feedback.
Answered by
DannyBen
Feb 3, 2023
Replies: 1 comment 2 replies
-
Sure. In general, everything in the documentation about Command, refers to command or subcommand (at any nesting level). The default directive is what we need. Here is an example: # bashly.yml
name: cli
help: Sample application
version: 0.1.0
commands:
- name: list
alias: l
help: Show all sorts of lists
commands:
- name: installed
help: Show installed
default: force
- name: releases
help: Show releases
- name: branches
help: Show branches which generates: $ ./cli list
# this file is located in 'src/list_installed_command.sh'
# code for 'cli list installed' goes here
# you can edit it freely and regenerate (it will not be overwritten)
args: none $ ./cli -h
cli - Sample application
Usage:
cli COMMAND
cli [COMMAND] --help | -h
cli --version | -v
Commands:
list Show all sorts of lists
Options:
--help, -h
Show this help
--version, -v
Show version number $ ./cli list -h
cli list - Show all sorts of lists
Alias: l
Usage:
cli list COMMAND
cli list [COMMAND] --help | -h
Commands:
installed Show installed (default)
releases Show releases
branches Show branches
Options:
--help, -h
Show this help |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
halostatue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure. In general, everything in the documentation about Command, refers to command or subcommand (at any nesting level). The default directive is what we need.
Here is an example:
which generates: