Created
March 28, 2016 02:57
-
-
Save brandonpittman/941d6b55aa4594e8cc9b to your computer and use it in GitHub Desktop.
Hello world in Crystal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "option_parser" | |
capitalize = false | |
destination = "World" | |
OptionParser.parse! do |parser| | |
parser.banner = "Usage: salute [arguments]" | |
parser.on("-c", "--capitalize", "Capitalizes the sallute") { capitalize = true } | |
parser.on("-t NAME", "--to=NAME", "Specifies the name to salute") { |name| destination = name } | |
parser.on("-h", "--help", "Show this help") { puts parser } | |
end | |
destination = destination.capitalize if capitalize | |
puts "Hello #{destination}!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment