Class: TrelloFlow::Cli
- Inherits:
-
Object
- Object
- TrelloFlow::Cli
- Defined in:
- lib/trello_flow/cli.rb
Class Attribute Summary collapse
-
.client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #ask(message, type = nil) ⇒ Object
- #error(message) ⇒ Object
- #open_url(url) ⇒ Object
- #read(command) ⇒ Object
- #run(command) ⇒ Object
- #say(*args) ⇒ Object
- #success(message) ⇒ Object
- #table(items) ⇒ Object
- #title(message) ⇒ Object
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
11 12 13 |
# File 'lib/trello_flow/cli.rb', line 11 def client @client end |
Instance Method Details
#ask(message, type = nil) ⇒ Object
33 34 35 |
# File 'lib/trello_flow/cli.rb', line 33 def ask(, type = nil) highline.ask(, type) end |
#error(message) ⇒ Object
41 42 43 44 |
# File 'lib/trello_flow/cli.rb', line 41 def error() say(.red.bold) exit(false) end |
#open_url(url) ⇒ Object
20 21 22 23 |
# File 'lib/trello_flow/cli.rb', line 20 def open_url(url) return title(url) if ENV['BROWSER'] == 'echo' `open \"#{url}\"` end |
#read(command) ⇒ Object
51 52 53 |
# File 'lib/trello_flow/cli.rb', line 51 def read(command) `#{command}`.strip.presence end |
#run(command) ⇒ Object
46 47 48 49 |
# File 'lib/trello_flow/cli.rb', line 46 def run(command) title(command) system(command) || error("Error running: #{command}") end |
#say(*args) ⇒ Object
25 26 27 |
# File 'lib/trello_flow/cli.rb', line 25 def say(*args) highline.say(*args) end |
#success(message) ⇒ Object
29 30 31 |
# File 'lib/trello_flow/cli.rb', line 29 def success() highline.say(.green.bold) end |
#table(items) ⇒ Object
16 17 18 |
# File 'lib/trello_flow/cli.rb', line 16 def table(items) puts Hirb::Helpers::AutoTable.render(items, unicode: true) end |
#title(message) ⇒ Object
37 38 39 |
# File 'lib/trello_flow/cli.rb', line 37 def title() highline.say(.bold) end |