Sha256: 683f998f412755e1b7f9f1942d2effa14b17d1d13a529602dd9c66e4904d9e89
Contents?: true
Size: 1005 Bytes
Versions: 2
Compression:
Stored size: 1005 Bytes
Contents
#!/usr/bin/env ruby $: << File.expand_path('lib') require 'cl' class Required < Cl::Cmd arg :one, required: true arg :two def run p cmd: registry_key, one: one, two: two end end Cl.new($0).run(%w(required one two)) # Output: # # {:cmd=>:required, :one=>"one", :two=>"two"} Cl.new($0).run(%w(required one)) # Output: # # {:cmd=>:required, :one=>"one", :two=>nil} Cl.new($0).run(%w(required)) # Output: # # Missing arguments (given: 0, required: 1) # # Usage: bin/examples required one [two] [options] # # Arguments: # # one type: string, required # two type: string # # Options: # # --help Get help on this command Cl.new($0).run(%w(required one two three)) # Output: # # Too many arguments: one two three (given: 3, allowed: 2) # # Usage: bin/examples required one [two] [options] # # Arguments: # # one type: string, required # two type: string # # Options: # # --help Get help on this command
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cl-1.2.2 | examples/args/required |
cl-1.2.1 | examples/args/required |