Class: Duty::Views::CLI::Normal
- Inherits:
-
Object
- Object
- Duty::Views::CLI::Normal
- Defined in:
- lib/duty/views/cli.rb
Direct Known Subclasses
Instance Method Summary collapse
- #command_failure(command) ⇒ Object
- #command_success(command) ⇒ Object
- #duty_explain ⇒ Object
-
#initialize(cli, input, output) ⇒ Normal
constructor
A new instance of Normal.
- #task_complete ⇒ Object
- #task_explain(task) ⇒ Object
- #task_failure(task) ⇒ Object
- #task_invalid(error) ⇒ Object
- #task_success(task) ⇒ Object
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_explain ⇒ Object
13 14 15 |
# File 'lib/duty/views/cli.rb', line 13 def duty_explain output.print end |
#task_complete ⇒ Object
17 18 19 |
# File 'lib/duty/views/cli.rb', line 17 def task_complete output.print 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) = "duty: `#{input.join(' ')}` is not a duty task. Failed with: #{error.message}" output.print 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 |