Class: Crowbar::Client::App::Base
- Inherits:
-
Thor
- Object
- Thor
- Crowbar::Client::App::Base
- Defined in:
- lib/crowbar/client/app/base.rb
Overview
A base class that provides helper for the wrappers
Direct Known Subclasses
Backup, Barclamp, Batch, Database, Entry, HostIP, Installer, Interface, Network, Node, Proposal, Repository, Restricted, Role, Server, Services, Ses, Upgrade, VirtualIP
Class Method Summary collapse
-
.banner(command, namespace = nil, subcommand = true) ⇒ String
A banner that gets displayed on help and error.
-
.handle_argument_error(command, error, args, arity) ⇒ Object
Properly print an error on invalid command.
Instance Method Summary collapse
-
#initialize(args = [], local_options = {}, config = {}) ⇒ Crowbar::Client::App::Base
constructor
Initialize the Thor command.
Constructor Details
#initialize(args = [], local_options = {}, config = {}) ⇒ Crowbar::Client::App::Base
Initialize the Thor command
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/crowbar/client/app/base.rb', line 35 def initialize(args = [], = {}, config = {}) super Config.configure( .slice( :alias, :username, :password, :server, :verify_ssl, :timeout, :anonymous, :apiversion, :debug ) ) end |
Class Method Details
.banner(command, namespace = nil, subcommand = true) ⇒ String
A banner that gets displayed on help and error
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/crowbar/client/app/base.rb', line 142 def (command, namespace = nil, subcommand = true) addition = command.formatted_usage( self, false, subcommand ) [ basename, addition ].compact.join(" ") end |
.handle_argument_error(command, error, args, arity) ⇒ Object
Properly print an error on invalid command
129 130 131 132 |
# File 'lib/crowbar/client/app/base.rb', line 129 def handle_argument_error(command, error, args, arity) $stderr.puts("Usage: #{(command)}") exit(2) end |