Class: OAuth::TTY::Command — Documentation by YARD 0.9.37

# Class: OAuth::TTY::Command

Inherits:
  Object
  - Object
  - OAuth::TTY::Command
  show all

Defined in:
  lib/oauth/tty/command.rb

## Direct Known Subclasses

OAuth::TTY::Commands::AuthorizeCommand, OAuth::TTY::Commands::HelpCommand, OAuth::TTY::Commands::QueryCommand, OAuth::TTY::Commands::SignCommand, OAuth::TTY::Commands::VersionCommand

## Instance Method Summary collapse

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

  A new instance of Command.

- #required_options ⇒ Object
- #run ⇒ Object

## 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_options ⇒ `Object`

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

    def required_options
      []
    end

### #run ⇒ `Object`

    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