File tree Expand file tree Collapse file tree 6 files changed +67
-0
lines changed
fixtures/workspaces/version-in-subcommands Expand file tree Collapse file tree 6 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 11# :command.fixed_flag_filter
22case "${1:-}" in
3+ % if root_command?
34% if short_flag_exist? "-v"
45--version )
56% else
@@ -9,6 +10,7 @@ case "${1:-}" in
910 exit
1011 ;;
1112
13+ % end
1214% if short_flag_exist? "-h"
1315--help )
1416% else
Original file line number Diff line number Diff line change 1+ + bundle exec bashly generate
2+ creating user files in src
3+ created src/initialize.sh
4+ created src/git_command.sh
5+ created ./cli
6+ run ./cli --help to test your bash script
7+ + ./cli --version
8+ 1.2.3
9+ + ./cli help
10+ cli - Sample application
11+
12+ Usage:
13+ cli [command]
14+ cli [command] --help | -h
15+ cli --version | -v
16+
17+ Commands:
18+ git Delegate to git
19+
20+ + ./cli git --version
21+ # this file is located in 'src/git_command.sh'
22+ # code for 'cli git' goes here
23+ # you can edit it freely and regenerate (it will not be overwritten)
24+ args: none
25+
26+ other_args:
27+ - ${other_args[*]} = --version
28+ - ${other_args[0]} = --version
29+ + ./cli git any 'other args' -or --flags
30+ # this file is located in 'src/git_command.sh'
31+ # code for 'cli git' goes here
32+ # you can edit it freely and regenerate (it will not be overwritten)
33+ args: none
34+
35+ other_args:
36+ - ${other_args[*]} = any other args -o -r --flags
37+ - ${other_args[0]} = any
38+ - ${other_args[1]} = other args
39+ - ${other_args[2]} = -o
40+ - ${other_args[3]} = -r
41+ - ${other_args[4]} = --flags
Original file line number Diff line number Diff line change 1+ src /* .sh
2+ cli
Original file line number Diff line number Diff line change 1+ This fixture tests that somcommands do not handle the --version flag
2+ ref: https://github.com/DannyBen/bashly/discussions/197
Original file line number Diff line number Diff line change 1+ name : cli
2+ help : Sample application
3+ version : 1.2.3
4+
5+ commands :
6+ - name : git
7+ help : Delegate to git
8+ catch_all : git_params
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ rm -f ./src/* .sh
4+
5+ set -x
6+
7+ bundle exec bashly generate
8+
9+ ./cli --version
10+ ./cli help
11+ ./cli git --version
12+ ./cli git any " other args" -or --flags
You can’t perform that action at this time.
0 commit comments