Skip to content

Commit d50607b

Browse files
committed
- Fix usage string when there is a forced default command
1 parent 51abbc3 commit d50607b

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

examples/render-mandoc/docs/download.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.1.9
22
.\"
3-
.TH "download" "1" "March 2024" "Version 0.1.0" "Sample application"
3+
.TH "download" "1" "April 2024" "Version 0.1.0" "Sample application"
44
.SH NAME
55
\f[B]download\f[R] - Sample application
66
.SH SYNOPSIS

examples/render-mandoc/docs/download.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% download(1) Version 0.1.0 | Sample application
22
% Lana Lang
3-
% March 2024
3+
% April 2024
44

55
NAME
66
==================================================

lib/bashly/script/command.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,11 @@ def summary_string
308308
# Returns a constructed string suitable for Usage pattern
309309
def usage_string
310310
result = [full_name]
311+
command_string = default_command&.default == 'force' ? '[COMMAND]' : 'COMMAND'
311312

312313
result.push case mode
313-
when :global_flags then ['[OPTIONS]', 'COMMAND']
314-
when :commands then ['COMMAND']
314+
when :global_flags then ['[OPTIONS]', command_string]
315+
when :commands then [command_string]
315316
when :args_and_flags then usage_string_args + ['[OPTIONS]']
316317
when :args then usage_string_args
317318
when :flags then ['[OPTIONS]']

spec/approvals/examples/command-default-force

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ run ./tester --help to test your bash script
88
tester - Sample application that uses the forced default command option
99

1010
Usage:
11-
tester COMMAND
11+
tester [COMMAND]
1212
tester [COMMAND] --help | -h
1313
tester --version | -v
1414

spec/approvals/examples/render-mandoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ ISSUE TRACKER
4444
AUTHORS
4545
Lana Lang.
4646

47-
Version 0.1.0 March 2024 download(1)
47+
Version 0.1.0 April 2024 download(1)

0 commit comments

Comments
 (0)