Class: Duty::Views::CLI::Normal

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

Direct Known Subclasses

Verbose

Instance Method Summary collapse

Constructor Details

#initialize(cli, input, output) ⇒ Normal

Returns a new instance of Normal.



7
8
9
10
11
# File 'lib/duty/views/cli.rb', line 7

def initialize(cli, input, output)
  @cli = cli
  @input = input
  @output = output
end

Instance Method Details

#command_failure(command) ⇒ Object



50
51
52
53
# File 'lib/duty/views/cli.rb', line 50

def command_failure(command)
  description = command.description
  failure(description)
end

#command_success(command) ⇒ Object



45
46
47
48
# File 'lib/duty/views/cli.rb', line 45

def command_success(command)
  description = command.description
  success(description)
end

#duty_explainObject



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

def duty_explain
  output.print meta_help_message 
end

#task_completeObject



17
18
19
# File 'lib/duty/views/cli.rb', line 17

def task_complete
  output.print meta_completion_message 
end

#task_explain(task) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/duty/views/cli.rb', line 21

def task_explain(task)
  task_class = task.class
  description = task_class.description
  usage = task_class.usage

  output.print(description)
  output.print(usage)
end

#task_failure(task) ⇒ Object



35
36
37
38
# File 'lib/duty/views/cli.rb', line 35

def task_failure(task)
  task_name = task.class.name
  failure("#{task_name} task aborted")
end

#task_invalid(error) ⇒ Object



40
41
42
43
# File 'lib/duty/views/cli.rb', line 40

def task_invalid(error)
  error_message = "duty: `#{input.join(' ')}` is not a duty task. Failed with: #{error.message}"
  output.print error_message
end

#task_success(task) ⇒ Object



30
31
32
33
# File 'lib/duty/views/cli.rb', line 30

def task_success(task)
  task_name = task.class.name
  success("#{task_name} task executed")
end