Class: OAuth::TTY::Command
- Inherits:
-
Object
- Object
- OAuth::TTY::Command
- Includes:
- Auth::Sanitizer::FilteredAttributes
- Defined in:
- lib/oauth/tty/command.rb
Overview
Base class for oauth-tty commands.
Includes Auth::Sanitizer::FilteredAttributes so inspect output redacts the accumulated command options hash, which may contain consumer or token secrets read from CLI flags or option files.
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.
- #inspect ⇒ Object
- #required_options ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(stdout, stdin, stderr, arguments) ⇒ Command
Returns a new instance of Command.
17 18 19 20 21 22 23 24 |
# File 'lib/oauth/tty/command.rb', line 17 def initialize(stdout, stdin, stderr, arguments) @stdout = stdout @stdin = stdin @stderr = stderr @options = {} option_parser.parse!(arguments) end |
Instance Method Details
#inspect ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/oauth/tty/command.rb', line 26 def inspect format( "#<%<klass>s:0x%<object_id>x @stdout=%<stdout>s, @stdin=%<stdin>s, @stderr=%<stderr>s, @options=[FILTERED], @option_parser=[FILTERED]>", klass: self.class, object_id: object_id, stdout: @stdout.inspect, stdin: @stdin.inspect, stderr: @stderr.inspect, ) end |
#required_options ⇒ Object
47 48 49 |
# File 'lib/oauth/tty/command.rb', line 47 def [] end |
#run ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/oauth/tty/command.rb', line 37 def run missing = - .keys if missing.empty? _run else show_missing(missing) puts option_parser.help end end |