class Sfctl::Command
Constants
- CONFIG_FILENAME
- CONFIG_PATH
- HARVEST_PROVIDER
- LINK_CONFIG_FILENAME
- LINK_CONFIG_PATH
- PROVIDERS_LIST
- TOGGL_PROVIDER
Public Instance Methods
access_token()
click to toggle source
# File lib/sfctl/command.rb, line 42 def access_token read_config['access_token'] end
command(**options)
click to toggle source
The external commands runner
@see www.rubydoc.info/gems/tty-command
@api public
# File lib/sfctl/command.rb, line 83 def command(**options) require 'tty-command' TTY::Command.new(options) end
config()
click to toggle source
Main configuration @api public
# File lib/sfctl/command.rb, line 26 def config @config ||= begin config = TTY::Config.new config.append_path Dir.home config end end
config_present?(output)
click to toggle source
# File lib/sfctl/command.rb, line 46 def config_present?(output) read_config rescue TTY::Config::ReadError output.puts Pastel.new(enabled: !@options['no-color']).red('Please authentificate before continue.') false end
execute(*)
click to toggle source
Execute this command
@api public
# File lib/sfctl/command.rb, line 71 def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end
link_config_present?(output)
click to toggle source
# File lib/sfctl/command.rb, line 61 def link_config_present?(output) read_link_config rescue TTY::Config::ReadError output.puts Pastel.new(enabled: !@options['no-color']).red('Please initialize time before continue.') false end
read_config()
click to toggle source
# File lib/sfctl/command.rb, line 38 def read_config config.read(CONFIG_PATH, format: :yaml) end
read_link_config()
click to toggle source
# File lib/sfctl/command.rb, line 53 def read_link_config config.read(LINK_CONFIG_PATH, format: :yaml) end
save_config!()
click to toggle source
# File lib/sfctl/command.rb, line 34 def save_config! config.write(CONFIG_PATH, format: :yaml, force: true) end
save_link_config!()
click to toggle source
# File lib/sfctl/command.rb, line 57 def save_link_config! config.write(LINK_CONFIG_PATH, format: :yaml, force: true) end