Class: Sfctl::Commands::Time::Providers::Set
- Inherits:
-
Sfctl::Command
- Object
- Sfctl::Command
- Sfctl::Commands::Time::Providers::Set
- Defined in:
- lib/sfctl/commands/time/providers/set.rb
Constant Summary
Constants inherited from Sfctl::Command
Sfctl::Command::CONFIG_FILENAME, Sfctl::Command::CONFIG_PATH, Sfctl::Command::HARVEST_PROVIDER, Sfctl::Command::LINK_CONFIG_FILENAME, Sfctl::Command::LINK_CONFIG_PATH, Sfctl::Command::PROVIDERS_LIST, Sfctl::Command::TOGGL_PROVIDER
Instance Method Summary collapse
- #execute(output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Set
constructor
A new instance of Set.
Methods inherited from Sfctl::Command
#access_token, #command, #config, #config_present?, #link_config_present?, #read_config, #read_link_config, #save_config!, #save_link_config!
Constructor Details
#initialize(options) ⇒ Set
Returns a new instance of Set.
10 11 12 13 |
# File 'lib/sfctl/commands/time/providers/set.rb', line 10 def initialize() @options = @pastel = Pastel.new(enabled: !@options['no-color']) end |
Instance Method Details
#execute(output: $stdout) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sfctl/commands/time/providers/set.rb', line 15 def execute(output: $stdout) return unless config_present?(output) prompt = ::TTY::Prompt.new provider = prompt.select('Setting up:', PROVIDERS_LIST) !ask_for_replace(output, prompt) && return unless config.fetch("providers.#{provider}").nil? case provider when TOGGL_PROVIDER setup_toggl_provider!(output, prompt) when HARVEST_PROVIDER setup_harvest_provider!(output, prompt) end end |