Skip to content

Is it possible to have a default subcommand of a subcommand? #325

Answered by DannyBen
halostatue asked this question in Q&A
Discussion options

You must be logged in to vote

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…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@halostatue
Comment options

@DannyBen
Comment options

Answer selected by halostatue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants