Class: Github::Auth::CLI
- Inherits:
-
Object
- Object
- Github::Auth::CLI
- Defined in:
- lib/github/auth/cli.rb
Overview
Command Line Interface for parsing and executing commands
Constant Summary collapse
- COMMANDS =
%w(add remove)
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#usernames ⇒ Object
readonly
Returns the value of attribute usernames.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
8 9 10 11 |
# File 'lib/github/auth/cli.rb', line 8 def initialize(argv) @command = argv.shift @usernames = argv end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
4 5 6 |
# File 'lib/github/auth/cli.rb', line 4 def command @command end |
#usernames ⇒ Object (readonly)
Returns the value of attribute usernames.
4 5 6 |
# File 'lib/github/auth/cli.rb', line 4 def usernames @usernames end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/github/auth/cli.rb', line 13 def execute if COMMANDS.include?(command) && !usernames.empty? send command elsif command == '--version' print_version else print_usage end end |