Class: OAuth::TTY::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth/tty/cli.rb

Constant Summary collapse

ALIASES =
{
  "h" => "help",
  "v" => "version",
  "q" => "query",
  "a" => "authorize",
  "s" => "sign"
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout, stdin, stderr, command, arguments) ⇒ CLI

Returns a new instance of CLI.



18
19
20
21
22
# File 'lib/oauth/tty/cli.rb', line 18

def initialize(stdout, stdin, stderr, command, arguments)
  klass = get_command_class(parse_command(command))
  @command = klass.new(stdout, stdin, stderr, arguments)
  @help_command = Commands::HelpCommand.new(stdout, stdin, stderr, [])
end

Class Method Details

.puts_red(string) ⇒ Object



6
7
8
# File 'lib/oauth/tty/cli.rb', line 6

def self.puts_red(string)
  puts "\033[0;91m#{string}\033[0m"
end

Instance Method Details

#runObject



24
25
26
# File 'lib/oauth/tty/cli.rb', line 24

def run
  @command.run
end