Class: Holistics::CLI
- Inherits:
-
Thor
- Object
- Thor
- Holistics::CLI
- Defined in:
- lib/holistics.rb
Instance Method Summary collapse
- #config(token = nil) ⇒ Object
-
#initialize(args = [], local_options = {}, config = {}) ⇒ CLI
constructor
A new instance of CLI.
- #version ⇒ Object
Constructor Details
#initialize(args = [], local_options = {}, config = {}) ⇒ CLI
Returns a new instance of CLI.
42 43 44 45 |
# File 'lib/holistics.rb', line 42 def initialize(args = [], = {}, config = {}) require_config! unless %w{help config version}.include? config[:current_command].name super end |
Instance Method Details
#config(token = nil) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/holistics.rb', line 55 def config(token = nil) unless token current_config = configured? ? read_config : {} current_token = current_config[:token] new_token = ask "Your Holistics token [#{current_token.to_s.light_black}]: " new_token = nil if new_token.blank? unless token = new_token || current_token STDERR.puts 'Failed to config, empty token provided !' exit 1 end end verify_token(token) do write_config(:token => token) end end |