class Sidedock::CLI
Public Class Methods
new(default_options = '')
click to toggle source
# File lib/sidedock/cli.rb, line 7 def initialize(default_options = '') @default_options = default_options end
Public Instance Methods
command_runner()
click to toggle source
# File lib/sidedock/cli.rb, line 19 def command_runner if Sidedock.configuration.debug debug_command_runner else quiet_command_runner end end
debug_command_runner()
click to toggle source
# File lib/sidedock/cli.rb, line 27 def debug_command_runner @debug_command_runner ||= TTY::Command.new end
execute(command)
click to toggle source
# File lib/sidedock/cli.rb, line 12 def execute(command) full_command = "#{program} #{@default_options} #{command}" stdout, stderr = command_runner.run full_command raise "`#{command}` failed" if stderr.present? stdout.strip end
quiet_command_runner()
click to toggle source
# File lib/sidedock/cli.rb, line 31 def quiet_command_runner @quiet_command_runner ||= TTY::Command.new printer: :null end