Skip to content

Commit

Permalink
- Fix usage string when there is a forced default command
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyBen committed Apr 18, 2024
1 parent 51abbc3 commit d50607b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.9
.\"
.TH "download" "1" "March 2024" "Version 0.1.0" "Sample application"
.TH "download" "1" "April 2024" "Version 0.1.0" "Sample application"
.SH NAME
\f[B]download\f[R] - Sample application
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% download(1) Version 0.1.0 | Sample application
% Lana Lang
% March 2024
% April 2024

NAME
==================================================
Expand Down
5 changes: 3 additions & 2 deletions lib/bashly/script/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ def summary_string
# Returns a constructed string suitable for Usage pattern
def usage_string
result = [full_name]
command_string = default_command&.default == 'force' ? '[COMMAND]' : 'COMMAND'

result.push case mode
when :global_flags then ['[OPTIONS]', 'COMMAND']
when :commands then ['COMMAND']
when :global_flags then ['[OPTIONS]', command_string]
when :commands then [command_string]
when :args_and_flags then usage_string_args + ['[OPTIONS]']
when :args then usage_string_args
when :flags then ['[OPTIONS]']
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/examples/command-default-force
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ run ./tester --help to test your bash script
tester - Sample application that uses the forced default command option

Usage:
tester COMMAND
tester [COMMAND]
tester [COMMAND] --help | -h
tester --version | -v

Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/examples/render-mandoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ ISSUE TRACKER
AUTHORS
Lana Lang.

Version 0.1.0 March 2024 download(1)
Version 0.1.0 April 2024 download(1)

0 comments on commit d50607b

Please sign in to comment.