Class: OAuth::TTY::Command

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

Instance Method Summary collapse

Constructor Details

#initialize(stdout, stdin, stderr, arguments) ⇒ Command

Returns a new instance of Command.



6
7
8
9
10
11
12
13
# File 'lib/oauth/tty/command.rb', line 6

def initialize(stdout, stdin, stderr, arguments)
  @stdout = stdout
  @stdin = stdin
  @stderr = stderr

  @options = {}
  option_parser.parse!(arguments)
end

Instance Method Details

#required_optionsObject



25
26
27
# File 'lib/oauth/tty/command.rb', line 25

def required_options
  []
end

#runObject



15
16
17
18
19
20
21
22
23
# File 'lib/oauth/tty/command.rb', line 15

def run
  missing = required_options - options.keys
  if missing.empty?
    _run
  else
    show_missing(missing)
    puts option_parser.help
  end
end