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"
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CLI.



26
27
28
29
30
# File 'lib/oauth/cli.rb', line 26

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



14
15
16
# File 'lib/oauth/cli.rb', line 14

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

Instance Method Details

#runObject



32
33
34
# File 'lib/oauth/cli.rb', line 32

def run
  @command.run
end