Class: Moonshot::Command
- Inherits:
-
Object
- Object
- Moonshot::Command
- Defined in:
- lib/moonshot/command.rb
Overview
A Command that is automatically registered with the Moonshot::CommandLine
Direct Known Subclasses
Moonshot::Commands::Build, Moonshot::Commands::Console, Moonshot::Commands::Create, Moonshot::Commands::Delete, Moonshot::Commands::Deploy, Moonshot::Commands::Doctor, Moonshot::Commands::GenerateTemplate, Moonshot::Commands::List, Moonshot::Commands::New, Moonshot::Commands::Push, Moonshot::Commands::Status, Moonshot::Commands::Update, Moonshot::Commands::Version, SSHCommand
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.inherited(base) ⇒ Object
13 14 15 16 |
# File 'lib/moonshot/command.rb', line 13 def self.inherited(base) Moonshot::CommandLine.register(base) base.extend(ClassMethods) end |
Instance Method Details
#parser ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/moonshot/command.rb', line 18 def parser @use_interactive_logger = true OptionParser.new do |o| o. = "Usage: moonshot #{self.class.usage}" o.on('-v', '--[no-]verbose', 'Show debug logging') do |v| Moonshot.config.interactive_logger = InteractiveLogger.new(debug: true) if v end o.on('-nNAME', '--environment=NAME', 'Which environment to operate on.') do |v| Moonshot.config.environment_name = v end o.on('--[no-]interactive-logger', TrueClass, 'Enable or disable fancy logging') do |v| @use_interactive_logger = v end end end |