Class: OAuth::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth/cli.rb,
lib/oauth/cli/base_command.rb,
lib/oauth/cli/help_command.rb,
lib/oauth/cli/sign_command.rb,
lib/oauth/cli/query_command.rb,
lib/oauth/cli/version_command.rb,
lib/oauth/cli/authorize_command.rb

Defined Under Namespace

Classes: AuthorizeCommand, BaseCommand, HelpCommand, QueryCommand, SignCommand, VersionCommand

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CLI.



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

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

Class Method Details

.puts_red(string) ⇒ Object



12
13
14
# File 'lib/oauth/cli.rb', line 12

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

Instance Method Details

#runObject



30
31
32
# File 'lib/oauth/cli.rb', line 30

def run
  @command.run
end