Skip to content

Commit afcc02f

Browse files
authored
Merge pull request #620 from DannyBen/add/header_override
Add `help_header_override` command option
2 parents 966651b + 2a8b5de commit afcc02f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/bashly/config_validator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def assert_command(key, value)
186186

187187
assert_string "#{key}.name", value['name']
188188
assert_optional_string "#{key}.help", value['help']
189+
assert_optional_string "#{key}.help_header_override", value['help_header_override']
189190
assert_optional_string "#{key}.footer", value['footer']
190191
assert_optional_string "#{key}.group", value['group']
191192
assert_optional_string "#{key}.filename", value['filename']

lib/bashly/script/command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def option_keys
1717
alias args catch_all commands completions
1818
default dependencies environment_variables examples
1919
extensible expose filename filters flags
20-
footer function group help name
20+
footer function group help help_header_override name
2121
private variables version
2222
]
2323
end

lib/bashly/views/command/usage.gtx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
= view_marker
22

33
> {{ function_name }}_usage() {
4-
if summary == help
4+
if summary == help && !help_header_override
55
> printf "{{ caption_string.sanitize_for_print }}\n\n"
66
else
77
> if [[ -n $long_usage ]]; then
8-
> printf "{{ full_name }}\n\n"
9-
> printf "{{ help.wrap(78).indent(2).sanitize_for_print }}\n\n"
8+
if help_header_override
9+
= help_header_override.indent 4
10+
else
11+
> printf "{{ full_name }}\n\n"
12+
> printf "{{ help.wrap(78).indent(2).sanitize_for_print }}\n\n"
13+
end
1014
> else
1115
> printf "{{ caption_string.sanitize_for_print }}\n\n"
1216
> fi

0 commit comments

Comments
 (0)