Class: Intent::Commands::Inventory
- Defined in:
- lib/intent/commands/inventory.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#generate_id, #initialize, #print_help
Constructor Details
This class inherits a constructor from Intent::Commands::Base
Instance Method Details
#run(args, output) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/intent/commands/inventory.rb', line 4 def run(args, output) if args.empty? print_help(output) else case args.first.to_sym when :help print_help(output) when :list tree = TTY::Tree.new(inventory_tree) output.puts(tree.render) when :add noun = args[1].to_sym case noun when :folder then add_folder(args, output) when :box then add_box(args, output) when :stock then add_stock(args, output) else raise "Noun not found" end when :assign noun = args[1].to_sym case noun when :folder then assign_folder(args, output) when :box then assign_box(args, output) end # CONCEPT: # Verbs::Assign.invoke_rewrite() # verbs.assign.invoke_rewrite(documents.inventory, noun) when :sync then sync_inventory(args, output) else raise Errors:COMMAND_NOT_FOUND end end end |