class OAuth::TTY::CLI
Constants
- ALIASES
Public Class Methods
Source
# 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
Source
# File lib/oauth/tty/cli.rb, line 6 def self.puts_red(string) puts "\033[0;91m#{string}\033[0m" end
Public Instance Methods
Private Instance Methods
Source
# File lib/oauth/tty/cli.rb, line 30 def get_command_class(command) Object.const_get("OAuth::TTY::Commands::#{command.capitalize}Command") end
Source
# File lib/oauth/tty/cli.rb, line 34 def parse_command(command) case command = command.to_s.downcase when "--version", "-v" "version" when "--help", "-h", nil, "" "help" when *ALIASES.keys ALIASES[command] when *ALIASES.values command else OAuth::TTY::CLI.puts_red "Command '#{command}' not found" "help" end end