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 37
37
printf "<%= strings[:options] %> \n"
38
38
<%= render(:usage_fixed_flags).indent 4 %>
39
39
<%= 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 %>
41
41
<%= render(:usage_environment_variables).indent 4 if environment_variables.any? %>
42
42
<%= render(:usage_examples).indent 4 if examples %>
43
43
Original file line number Diff line number Diff line change 1
1
# :command.usage_args
2
2
printf "<%= strings[:arguments] %> \n"
3
+ <%- if args.any? -%>
3
4
4
5
<%- args.each do |arg| -%>
5
6
<%= arg.render(:usage) %>
6
7
<%- end -%>
7
-
8
+ <%- end -%>
8
9
<%- if catch_all_help -%>
10
+
9
11
echo " <%= catch_all_label %> "
10
12
printf "<%= catch_all_help.wrap(76).indent(4).sanitize_for_print %> \n"
11
13
echo
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