Module: Cult::CLI::CommandDSLExtensions
- Defined in:
- lib/cult/cli/cri_extensions.rb
Instance Method Summary collapse
-
#none ⇒ Object
Lets us say run(arguments: none).
- #optional_project ⇒ Object
-
#run(arguments: nil, &block) ⇒ Object
This allows an explicit number of arguments to be passed to run, and halts with an error otherwise.
-
#unlimited ⇒ Object
Lets us say run(arguments: 1 .. unlimited) instead of run(arguments: 1 .. Float::INFINITY) or just outright: run(arguments: unlimited).
Instance Method Details
#none ⇒ Object
Lets us say run(arguments: none)
122 123 124 |
# File 'lib/cult/cli/cri_extensions.rb', line 122 def none 0 end |
#optional_project ⇒ Object
108 109 110 |
# File 'lib/cult/cli/cri_extensions.rb', line 108 def optional_project @command.project_required = false end |
#run(arguments: nil, &block) ⇒ Object
This allows an explicit number of arguments to be passed to run, and halts with an error otherwise
128 129 130 131 |
# File 'lib/cult/cli/cri_extensions.rb', line 128 def run(arguments: nil, &block) @command.argument_spec = arguments if arguments super(&block) end |
#unlimited ⇒ Object
Lets us say run(arguments: 1 .. unlimited) instead of
run(arguments: 1 .. Float::INFINITY)
or just outright:
run(arguments: unlimited)
117 118 119 |
# File 'lib/cult/cli/cri_extensions.rb', line 117 def unlimited Float::INFINITY end |