Class: Cardigan::RootContext
- Inherits:
-
Object
- Object
- Cardigan::RootContext
- Includes:
- ShellShock::Context
- Defined in:
- lib/cardigan/root_context.rb
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(io, repository, name, workflow_repository) ⇒ RootContext
constructor
A new instance of RootContext.
Constructor Details
#initialize(io, repository, name, workflow_repository) ⇒ RootContext
Returns a new instance of RootContext.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cardigan/root_context.rb', line 9 def initialize io, repository, name, workflow_repository @io, @repository, @name, @workflow_repository = io, repository, name, workflow_repository @prompt = "#{File.('.').split('/').last} > " @commands = { 'claim' => Command.load(:claim_cards, @repository, @io, @name), 'touch' => Command.load(:create_card, @repository), 'rm' => Command.load(:destroy_cards, @repository, @io), 'columns' => Command.load(:specify_display_columns, @repository, @io), 'filter' => Command.load(:filter_cards, @repository, @io), 'ls' => Command.load(:list_cards, @repository, @io), 'cd' => Command.load(:open_card, @repository, @workflow_repository, @io), 'set' => Command.load(:batch_update_cards, @repository, @io), 'sort' => Command.load(:specify_sort_columns, @repository, @io), 'unclaim' => Command.load(:unclaim_cards, @repository, @io), 'unfilter' => Command.load(:unfilter_cards, @repository, @io), 'workflow' => Command.load(:open_workflow, @workflow_repository, @io), 'count' => Command.load(:count_cards, @repository, @io), 'total' => Command.load(:total_cards, @repository, @io), 'export' => Command.load(:export_cards, @repository), 'import' => Command.load(:import_cards, @repository, @io), 'commit' => Command.load(:commit_changes, @repository, @io) } end |
Instance Method Details
#execute(args) ⇒ Object
33 34 35 36 |
# File 'lib/cardigan/root_context.rb', line 33 def execute args command = args.shift @commands[command].execute args.join(' ') end |