Skip to content

Commit 147b81f

Browse files
authored
lavinmqctl --help touchups (#1755)
### WHAT is this pull request doing? - **Add a "Miscellaneous" separator to `lavinmqctl`** - For consistency with `lavinmq --help` - **Return with exit code 0 for `lavinmqctl --help`** - It seems like the right exit code for a deliberate command, also consistent with `lavinmq --help` - **Drop the colons on the separators in `lavinmqctl`** - For consistency with `lavinmq --help` ### HOW can this pull request be tested? ```sh lavinmqctl --help # should show the --help and friends under a "Miscellaneous" separator echo $? # now 0, previously 1 ```
1 parent f4fa7ce commit 147b81f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lavinmqctl/cli.cr

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class LavinMQCtl
6565
end
6666

6767
def parse_cmd
68-
@parser.separator("\nCommands:")
68+
@parser.separator("\nCommands")
6969
COMPAT_CMDS.each do |cmd|
7070
@parser.on(cmd[0], cmd[1]) do
7171
@cmd = cmd[0]
@@ -224,11 +224,12 @@ class LavinMQCtl
224224
@args["queue"] = JSON::Any.new(v)
225225
end
226226
end
227+
@parser.separator("\nMiscellaneous")
227228
@parser.on("-v", "--version", "Show version") { @io.puts LavinMQ::VERSION; exit 0 }
228229
@parser.on("--build-info", "Show build information") { @io.puts LavinMQ::BUILD_INFO; exit 0 }
229230
@parser.on("-h", "--help", "Show this help") do
230231
@io.puts @parser
231-
exit 1
232+
exit 0
232233
end
233234
@parser.invalid_option { |arg| abort "Invalid argument: #{arg}" }
234235
end
@@ -348,7 +349,7 @@ class LavinMQCtl
348349
end
349350

350351
private def global_options
351-
@parser.separator("\nGlobal options:")
352+
@parser.separator("\nGlobal options")
352353
@parser.on("-p vhost", "--vhost=vhost", "Specify vhost") do |v|
353354
@options["vhost"] = v
354355
end

0 commit comments

Comments
 (0)