Class: Duty::CLI::View

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

Direct Known Subclasses

VerboseView

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ View

Returns a new instance of View.



135
136
137
# File 'lib/duty/cli.rb', line 135

def initialize(output)
  @output = output
end

Instance Method Details

#command_failure(command) ⇒ Object



163
164
165
166
# File 'lib/duty/cli.rb', line 163

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

#command_success(command) ⇒ Object



158
159
160
161
# File 'lib/duty/cli.rb', line 158

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

#task_explain(task) ⇒ Object



139
140
141
142
143
144
145
146
# File 'lib/duty/cli.rb', line 139

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



153
154
155
156
# File 'lib/duty/cli.rb', line 153

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

#task_success(task) ⇒ Object



148
149
150
151
# File 'lib/duty/cli.rb', line 148

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