Class: GridCLI::SubgridCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- GridCLI::SubgridCommand
- Defined in:
- lib/gridcli/commands/subgrid.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#initialize ⇒ SubgridCommand
constructor
A new instance of SubgridCommand.
- #run(args) ⇒ Object
- #usage ⇒ Object
Methods inherited from BaseCommand
#add_format_option, #add_option, #error, #log, #output_format, #parse_dates, #parse_opts, #pop_arg, #pprint
Constructor Details
#initialize ⇒ SubgridCommand
Returns a new instance of SubgridCommand.
3 4 5 |
# File 'lib/gridcli/commands/subgrid.rb', line 3 def initialize super "subgrid", "Create / read / update subgrids (groups)" end |
Instance Method Details
#run(args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gridcli/commands/subgrid.rb', line 11 def run(args) subgrids = SubGrids.new groups = (args.length == 0) ? subgrids.groups : [args.shift] # if setting users... if args.length > 0 subgrids.set_group(groups.first, args.first.split(",")) end groups.each { |gname| error("Group not found: #{gname}") unless subgrids.groups.include? gname puts "#{gname} has users: #{subgrids.get_group(gname).join(', ')}" } end |
#usage ⇒ Object
7 8 9 |
# File 'lib/gridcli/commands/subgrid.rb', line 7 def usage super "[<groupname> [<comma separated list of users>]]" end |