bindgen
bindgen copied to clipboard
Use built in option parser for find_clang.cr
https://crystal-lang.org/api/0.34.0/OptionParser.html
require "option_parser"
upcase = false
destination = "World"
OptionParser.parse do |parser|
parser.banner = "Usage: salute [arguments]"
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") do
puts parser
exit
end
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
puts "Hello #{destination}!"
Related to #38
(We could also use Stefan's toka
, which is already used as part of bindgen)
True, but i noticed find_clang was absent of any shard dependencies. Using the built in lib would continue this.