Sha256: f34f3f18226ae341d222ff226681b8fbec56a669613f738da4d3634c5ec7c3bc
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
require 'cl' # e.g. lib/owners/add.rb module Owners class Add < Cl::Cmd register :add summary 'Add one or more owners to an existing owner group' description <<~str Use this command to add one or more owners to an existing owner group. [...] str args :owner opt '-t', '--to TO', 'An existing owner group' def run # implement adding the owner as given in `owner` (as well as `args`) # to the group given in `to` (as well as `opts[:to]`). p owner: owner, to: to, to?: to?, args: args, opts: opts end end end # Running this, e.g. using `bin/owners add one,two --to group` will instantiate the # class `Owners::Add`, and call the method `run` on it. # e.g. bin/owners # # args normally would be ARGV args = %w(add one --to group) Cl.new('owners').run(args) # Output: # # {:owner=>"one", :to=>"group", :to?=>true, :args=>["one"], :opts=>{:to=>"group"}} Cl.new('owners').run(%w(add --help)) # Output: # # Usage: owners add [owner] [options] # # Summary: # # Add one or more owners to an existing owner group # # Description: # # Use this command to add one or more owners to an existing # owner group. # # [...] # # Arguments: # # owner type: string # # Options: # # -t --to TO An existing owner group (type: string) # --help Get help on this command
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
travis-cl-1.2.4 | examples/readme/basic |
cl-1.2.4 | examples/readme/basic |
cl-1.2.3 | examples/readme/basic |