Sha256: ee39f55daae27b02e03daac8a1249a27be707aab03b5a409e9af5ff3beb9f693
Contents?: true
Size: 823 Bytes
Versions: 5
Compression:
Stored size: 823 Bytes
Contents
#!/usr/bin/env ruby require "bundler/setup" require "argy" parser = Argy.new do |o| o.description "Prints messages" o.usage "example" o.example "$ example hello" o.argument :message, desc: "message to print", required: true o.option :loud, type: :boolean, desc: "say the message loudly" o.option :times, type: :integer, desc: "number of times to print", default: 1 o.on "-v", "print the verison and exit" do puts Argy::VERSION exit end o.on "-h", "--help", "show this help and exit" do puts o.help puts o.help.section "SECTION" puts o.help.entry "foo", desc: "bar" exit end end begin options = parser.parse(ARGV) message = options.message message = message.upcase if options.loud? options.times.times { puts message } rescue Argy::Error => err abort err.message end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
argy-0.2.3 | bin/example |
argy-0.0.0 | bin/example |
argy-0.2.2 | bin/example |
argy-0.2.1 | bin/example |
argy-0.2.0 | bin/example |