Skip to content

Commit

Permalink
OptionParser documentation improvement (#6131)
Browse files Browse the repository at this point in the history
Expanded the example to show how to handle invalid options.
  • Loading branch information
masukomi authored and RX14 committed May 26, 2018
1 parent bc04afd commit 3c887de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/option_parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
# parser.on("-u", "--upcase", "Upcases the salute") { upcase = true }
# parser.on("-t NAME", "--to=NAME", "Specifies the name to salute") { |name| destination = name }
# parser.on("-h", "--help", "Show this help") { puts parser }
# parser.invalid_option do |flag|
# STDERR.puts "ERROR: #{flag} is not a valid option."
# STDERR.puts parser
# exit(1)
# end
# end
#
# destination = destination.upcase if upcase
Expand Down

0 comments on commit 3c887de

Please sign in to comment.