File tree Expand file tree Collapse file tree 6 files changed +67
-1
lines changed
fixtures/workspaces/default-command-flag-only Expand file tree Collapse file tree 6 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ if commands.any?
44 > action=${1:-}
55 >
66 > case $action in
7- > -*) ;;
7+ unless default_command
8+ > -*) ;;
9+ end
810 >
911
1012 commands.each do |command|
Original file line number Diff line number Diff line change 1+ + bundle exec bashly generate
2+ creating user files in src
3+ created src/get_command.sh
4+ created ./cli
5+ run ./cli --help to test your bash script
6+ + ./cli
7+ # this file is located in 'src/get_command.sh'
8+ # code for 'cli get' goes here
9+ # you can edit it freely and regenerate (it will not be overwritten)
10+ args: none
11+ + ./cli -fd
12+ # this file is located in 'src/get_command.sh'
13+ # code for 'cli get' goes here
14+ # you can edit it freely and regenerate (it will not be overwritten)
15+ args:
16+ - ${args[--debug]} = 1
17+ - ${args[--force]} = 1
18+ + ./cli source -fd
19+ # this file is located in 'src/get_command.sh'
20+ # code for 'cli get' goes here
21+ # you can edit it freely and regenerate (it will not be overwritten)
22+ args:
23+ - ${args[--debug]} = 1
24+ - ${args[--force]} = 1
25+ - ${args[source]} = source
Original file line number Diff line number Diff line change 1+ cli
2+ src /* .sh
Original file line number Diff line number Diff line change 1+ This fixture tests that the default command is triggered even when only flags
2+ are provided.
3+ Reference issue: https://github.com/DannyBen/bashly/issues/537
Original file line number Diff line number Diff line change 1+ name : cli
2+ help : Test that default command is called when only flags are provided
3+ version : 0.1.0
4+
5+ commands :
6+ - name : get
7+ alias : g
8+ help : Get something
9+ default : force
10+
11+ args :
12+ - name : source
13+ help : Source
14+
15+ flags :
16+ - long : --debug
17+ short : -d
18+ help : Debug
19+
20+ - long : --force
21+ short : -f
22+ help : Force
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ rm -f ./src/* .sh
4+ rm -f ./cli
5+
6+ set -x
7+
8+ bundle exec bashly generate
9+
10+ ./cli
11+ ./cli -fd
12+ ./cli source -fd
You can’t perform that action at this time.
0 commit comments