Class: UltraCommandLine::Commands::SubCommand
- Inherits:
-
Object
- Object
- UltraCommandLine::Commands::SubCommand
- Extended by:
- Factory
- Includes:
- CommandLineParser, HelpFormatter, Validation, Utils::ErrorPropagation
- Defined in:
- lib/ultra_command_line/commands/sub_command.rb
Constant Summary
Constants included from Factory
Constants included from HelpFormatter
HelpFormatter::DEFAULT_SEPARATOR_FILLER, HelpFormatter::DEFAULT_SEPARATOR_WIDTH, HelpFormatter::DEFAULT_TITLE
Constants included from Utils::ErrorPropagation
Utils::ErrorPropagation::DEFAULT_ERROR_MESSAGE
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#banner ⇒ Object
Returns the value of attribute banner.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes included from HelpFormatter
#separator_filler, #separator_width
Instance Method Summary collapse
- #cmd_line_args ⇒ Object
-
#initialize(manager, name = '', banner = UltraCommandLine::Commands::Factory::DEFAULT_BANNER, options: []) ⇒ SubCommand
constructor
A new instance of SubCommand.
- #root_command? ⇒ Boolean
Methods included from Factory
Methods included from Utils::YamlFactory
Methods included from CommandLineParser
#extra_arguments, #params_hash
Methods included from HelpFormatter
Methods included from Validation
Constructor Details
#initialize(manager, name = '', banner = UltraCommandLine::Commands::Factory::DEFAULT_BANNER, options: []) ⇒ SubCommand
Returns a new instance of SubCommand.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 25 def initialize(manager, name = '', = UltraCommandLine::Commands::Factory::DEFAULT_BANNER, options: []) @manager = manager @name = name if name.empty? class << self; include UltraCommandLine::Commands::MainCommand; end end self. = @options = @aliases = [self.name] end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
22 23 24 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 22 def aliases @aliases end |
#banner ⇒ Object
Returns the value of attribute banner.
23 24 25 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 23 def @banner end |
#manager ⇒ Object
Returns the value of attribute manager.
22 23 24 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 22 def manager @manager end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 22 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
22 23 24 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 22 def @options end |
Instance Method Details
#cmd_line_args ⇒ Object
43 44 45 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 43 def cmd_line_args self_view_of_manager_cmd_line_args end |
#root_command? ⇒ Boolean
39 40 41 |
# File 'lib/ultra_command_line/commands/sub_command.rb', line 39 def root_command? singleton_class.ancestors.include? UltraCommandLine::Commands::MainCommand end |