File tree Expand file tree Collapse file tree 7 files changed +62
-3
lines changed
fixtures/workspaces/catch-all-no-args Expand file tree Collapse file tree 7 files changed +62
-3
lines changed Original file line number Diff line number Diff line change 3737 printf "<%= strings[:options] %> \n"
3838<%= render(:usage_fixed_flags).indent 4 %>
3939<%= render(:usage_flags).indent 4 if flags.any? %>
40- <%= render(:usage_args).indent 4 if args.any? %>
40+ <%= render(:usage_args).indent 4 if args.any? or catch_all_help %>
4141<%= render(:usage_environment_variables).indent 4 if environment_variables.any? %>
4242<%= render(:usage_examples).indent 4 if examples %>
4343
Original file line number Diff line number Diff line change 11# :command.usage_args
22printf "<%= strings[:arguments] %> \n"
3+ <%- if args.any? -%>
34
45<%- args.each do |arg| -%>
56<%= arg.render(:usage) %>
67<%- end -%>
7-
8+ <%- end -%>
89<%- if catch_all_help -%>
10+
911echo " <%= catch_all_label %> "
1012printf "<%= catch_all_help.wrap(76).indent(4).sanitize_for_print %> \n"
1113echo
12- <%- end -%>
14+ <%- end -%>
Original file line number Diff line number Diff line change 1+ + bashly generate
2+ creating user files in src
3+ created src/initialize.sh
4+ created src/root_command.sh
5+ created ./download
6+ run ./download --help to test your bash script
7+ + ./download
8+ # this file is located in 'src/root_command.sh'
9+ # you can edit it freely and regenerate (it will not be overwritten)
10+ args: none
11+ + ./download --help
12+ download - Download something
13+
14+ Usage:
15+ download [URLS...]
16+ download --help | -h
17+ download --version | -v
18+
19+ Options:
20+ --help, -h
21+ Show this help
22+
23+ --version, -v
24+ Show version number
25+
26+ Arguments:
27+ URLS...
28+ List of URLs
29+
Original file line number Diff line number Diff line change 1+ download
2+ src /* .sh
Original file line number Diff line number Diff line change 1+ This fixture tests that catch all with help is displayed even when the
2+ configuration file does not have any args defined.
3+ Reference issue: https://github.com/DannyBen/bashly/issues/74
Original file line number Diff line number Diff line change 1+ name : download
2+ help : Download something
3+ version : 0.1.0
4+
5+ catch_all :
6+ label : " URLs"
7+ help : " List of URLs"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # This fixture tests that catch all with help is displayed even when the
4+ # configuration file does not have any args defined.
5+ # It is executed as part of the Runfile examples test
6+ # Reference issue: https://github.com/DannyBen/bashly/issues/74
7+
8+ rm -f ./src/* .sh
9+ rm -f ./download
10+
11+ set -x
12+
13+ bashly generate
14+
15+ ./download
16+ ./download --help
You can’t perform that action at this time.
0 commit comments