Class: RubyNext::CLI
- Inherits:
-
Object
- Object
- RubyNext::CLI
- Defined in:
- lib/ruby-next/cli.rb
Overview
Command line interface for RubyNext
Constant Summary collapse
Class Attribute Summary collapse
-
.dry_run ⇒ Object
(also: dry_run?)
Returns the value of attribute dry_run.
-
.verbose ⇒ Object
(also: verbose?)
Returns the value of attribute verbose.
Instance Method Summary collapse
Class Attribute Details
.dry_run ⇒ Object Also known as: dry_run?
Returns the value of attribute dry_run.
13 14 15 |
# File 'lib/ruby-next/cli.rb', line 13 def dry_run @dry_run end |
.verbose ⇒ Object Also known as: verbose?
Returns the value of attribute verbose.
13 14 15 |
# File 'lib/ruby-next/cli.rb', line 13 def verbose @verbose end |
Instance Method Details
#run(args = ARGV) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ruby-next/cli.rb', line 27 def run(args = ARGV) maybe_print_version(args) command = extract_command(args) # Handle top-level help unless command maybe_print_help raise "Command must be specified!" end args.delete(command) args.unshift(*load_args_from_rc(command)) COMMANDS.fetch(command) do raise "Unknown command: #{command}. Available commands: #{COMMANDS.keys.join(",")}" end.run(args) end |