Class: Pair::Cli
- Inherits:
-
Object
- Object
- Pair::Cli
- Defined in:
- lib/pair/cli.rb,
lib/pair/cli/host.rb,
lib/pair/cli/config.rb,
lib/pair/cli/notify.rb,
lib/pair/cli/custom_errors.rb
Defined Under Namespace
Classes: ApiTokenMissingError, Config, EnableSSHError, Host, Notify
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(arguments) ⇒ Cli
constructor
A new instance of Cli.
- #run! ⇒ Object
Constructor Details
#initialize(arguments) ⇒ Cli
Returns a new instance of Cli.
14 15 16 17 |
# File 'lib/pair/cli.rb', line 14 def initialize(arguments) self.arguments = arguments self. = {} end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
7 8 9 |
# File 'lib/pair/cli.rb', line 7 def arguments @arguments end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/pair/cli.rb', line 7 def @options end |
Class Method Details
.run!(*arguments) ⇒ Object
10 11 12 |
# File 'lib/pair/cli.rb', line 10 def self.run!(*arguments) new(*arguments).run! end |
Instance Method Details
#run! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pair/cli.rb', line 19 def run! case command = arguments.shift when 'host' require "pair/cli/host" Host.run!(arguments) when 'config' require "pair/cli/config" Config.run!(arguments) when 'notify' require "pair/cli/notify" Notify.run!(arguments) else unknown_command(command) end rescue ApiTokenMissingError, EnableSSHError, Pair::Notification::GNTPError => error handle_error error., false rescue SystemExit raise rescue Exception => except handle_error " Please contact [email protected], there\n" + " was an issue creating your session.", $-d end |