File tree Expand file tree Collapse file tree 4 files changed +16
-11
lines changed Expand file tree Collapse file tree 4 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ if [[ -n $(validate_<%= validation_function %> "$1") ]]; then
33 printf "<%= strings[:validation_error] %> \n" "<%= name.upcase %> $(validate_<%= validation_function %> "$1")"
44 exit 1
55fi
6- % end
6+ % end
Original file line number Diff line number Diff line change 22% if args.any?
33% condition = "if"
44% args.each do |arg|
5- <%= condition %> [[ ! ${args[<%= arg.name %> ]} ]]; then
5+ <%= condition %> [[ -z ${args[<%= arg.name %> ]+x } ]]; then
66<%= arg.render(:validations).indent 2 %>
77 args[<%= arg.name %> ]=$1
88 shift
Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ if [[ -n $(validate_<%= validation_function %> "$2") ]]; then
33 printf "<%= strings[:validation_error] %> \n" "<%= usage_string %> $(validate_<%= validation_function %> "$2")"
44 exit 1
55fi
6- % end
6+ % end
Original file line number Diff line number Diff line change @@ -3,15 +3,20 @@ skipped src/initialize.sh (exists)
33skipped src/test_command.sh (exists)
44created ./cli
55run ./cli --help to test your bash script
6+ + ./cli test a b --flag c
7+ args:
8+ - ${args[--flag]} = c
9+ - ${args[optional_arg]} = b
10+ - ${args[required_arg]} = a
611+ ./cli test ''
7- # this file is located in 'src/test_command.sh'
8- # code for 'cli test' goes here
9- # you can edit it freely and regenerate (it will not be overwritten)
1012args:
11- - ${args[arg]} =
12- + ./cli test --flag ''
13- # this file is located in 'src/test_command.sh'
14- # code for 'cli test' goes here
15- # you can edit it freely and regenerate (it will not be overwritten)
13+ - ${args[required_arg]} =
14+ + ./cli test '' --flag ''
15+ args:
16+ - ${args[--flag]} =
17+ - ${args[required_arg]} =
18+ + ./cli test '' '' --flag ''
1619args:
1720- ${args[--flag]} =
21+ - ${args[optional_arg]} =
22+ - ${args[required_arg]} =
You can’t perform that action at this time.
0 commit comments