Class: Duty::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/duty/cli.rb

Constant Summary collapse

DUTY_CONFIG_FILENAME =
'.duty.yml'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI



12
13
14
15
16
# File 'lib/duty/cli.rb', line 12

def initialize(args)
  @input = Duty::IO::CLI::Input.new(args)
  @output = Duty::IO::CLI::Output.new($stdout, $stderr)
  @registry = Duty::Registry.register(Duty::Plugins.load(DUTY_CONFIG_FILENAME))
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



10
11
12
# File 'lib/duty/cli.rb', line 10

def registry
  @registry
end

Instance Method Details

#execObject



18
19
20
21
22
# File 'lib/duty/cli.rb', line 18

def exec
  explain_duty if needs_help?
  complete_task if needs_completion?
  execute_task
end