Skip to content

Commit 36379a1

Browse files
authored
Merge pull request #11 from KitaitiMakoto/usage
Fix command error handling
2 parents 2226fda + 09853fa commit 36379a1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bin/hikidoc

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ HTML_TEMPLATE = <<EOS
1616
</html>
1717
EOS
1818

19+
def usage
20+
"Usage: #$0 [OPTIONS] FILE"
21+
end
22+
1923
options = {}
2024
format_options = {}
2125
ARGV.options do |opts|
22-
opts.banner = "Usage: #$0 [OPTIONS] FILE"
26+
opts.banner = usage
2327

2428
opts.on('-f', '--fragment',
2529
'Output HTML fragments only') do
@@ -42,7 +46,7 @@ when 0
4246
when 1
4347
title, text = ARGV[0], File.read(ARGV[0])
4448
else
45-
usage
49+
abort ARGV.options.help
4650
end
4751

4852
body = HikiDoc.to_html(text, format_options)

0 commit comments

Comments
 (0)