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, Entry, HostIP, Installer, Interface, Network, Node, Proposal, Repository, Role, Server, 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 |
# File 'lib/crowbar/client/app/base.rb', line 35 def initialize(args = [], = {}, config = {}) super Config.configure( .slice( :alias, :username, :password, :server, :timeout, :anonymous, :apiversion, :debug ) ) end |
Class Method Details
.banner(command, namespace = nil, subcommand = true) ⇒ String
A banner that gets displayed on help and error
141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/crowbar/client/app/base.rb', line 141 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
128 129 130 131 |
# File 'lib/crowbar/client/app/base.rb', line 128 def handle_argument_error(command, error, args, arity) $stderr.puts("Usage: #{(command)}") exit(2) end |