Class: TempestTime::Command
- Inherits:
-
Object
- Object
- TempestTime::Command
show all
- Extended by:
- Forwardable
- Defined in:
- lib/tempest_time/command.rb
Direct Known Subclasses
TempestTime::Commands::Config::Edit, TempestTime::Commands::Config::Setup, TempestTime::Commands::Delete, TempestTime::Commands::Issues, TempestTime::Commands::List, TempestTime::Commands::Report, TempestTime::Commands::Submit, TempestTime::Commands::Teams::Add, TempestTime::Commands::Teams::Delete, TempestTime::Commands::Teams::Edit, TempestTime::Commands::Track
Instance Method Summary
collapse
Instance Method Details
#command ⇒ Object
18
19
20
21
|
# File 'lib/tempest_time/command.rb', line 18
def command
require 'tty-command'
TTY::Command.new
end
|
#execute ⇒ Object
11
12
13
14
15
16
|
# File 'lib/tempest_time/command.rb', line 11
def execute(*)
raise(
NotImplementedError,
"#{self.class}##{__method__} must be implemented"
)
end
|
#pastel(**options) ⇒ Object
23
24
25
26
|
# File 'lib/tempest_time/command.rb', line 23
def pastel(**options)
require 'pastel'
Pastel.new(options)
end
|
#prompt(**options) ⇒ Object
28
29
30
31
|
# File 'lib/tempest_time/command.rb', line 28
def prompt(**options)
require 'tty-prompt'
TTY::Prompt.new(options)
end
|
#spinner ⇒ Object
33
34
35
36
|
# File 'lib/tempest_time/command.rb', line 33
def spinner
require 'tty-spinner'
TTY::Spinner
end
|
#table ⇒ Object
38
39
40
41
|
# File 'lib/tempest_time/command.rb', line 38
def table
require 'tty-table'
TTY::Table
end
|
#with_spinner(message, format = :pong) {|s| ... } ⇒ Object
43
44
45
46
47
|
# File 'lib/tempest_time/command.rb', line 43
def with_spinner(message, format = :pong)
s = spinner.new(":spinner #{message}", format: format)
s.auto_spin
yield(s)
end
|
#with_success_fail_spinner(message, format = :spin_3) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/tempest_time/command.rb', line 49
def with_success_fail_spinner(message, format = :spin_3)
s = spinner.new(":spinner #{message}", format: format)
s.auto_spin
response = yield
if response.success?
s.success(pastel.green(response.message))
else
s.error(pastel.red(response.message))
end
end
|