Class: Wavesync::Commands::Command
- Inherits:
-
Object
- Object
- Wavesync::Commands::Command
- Defined in:
- lib/wavesync/commands/command.rb
Class Attribute Summary collapse
-
.description ⇒ Object
Returns the value of attribute description.
-
.name ⇒ Object
Returns the value of attribute name.
- .options ⇒ Object
- .subcommands ⇒ Object
Instance Method Summary collapse
-
#parse_options(banner:) ⇒ Object
: (banner: String) ?{ (OptionParser, Hash[Symbol, untyped]) -> void } -> [Hash[Symbol, untyped], Config].
Class Attribute Details
.description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/wavesync/commands/command.rb', line 9 def description @description end |
.name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/wavesync/commands/command.rb', line 9 def name @name end |
.options ⇒ Object
12 |
# File 'lib/wavesync/commands/command.rb', line 12 def = @options || [] |
.subcommands ⇒ Object
13 |
# File 'lib/wavesync/commands/command.rb', line 13 def subcommands = @subcommands || [] |
Instance Method Details
#parse_options(banner:) ⇒ Object
: (banner: String) ?{ (OptionParser, Hash[Symbol, untyped]) -> void } -> [Hash[Symbol, untyped], Config]
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wavesync/commands/command.rb', line 17 def (banner:) = {} #: Hash[Symbol, untyped] OptionParser.new do |opts| opts. = opts.on(*CONFIG_OPTION.to_a) { |value| [:config] = value } yield opts, if block_given? end.parse! config_path = [:config] || Wavesync::Config::DEFAULT_PATH config = Commands.load_config(config_path) [, config] end |