Class: VimPK::CLI
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 13 14 15 16 17 |
# File 'lib/vimpk/cli.rb', line 9 def initialize(argv) @argv = argv @parser = Options.new(argv) @options = @parser.parse @command = determine_command rescue OptionParser::MissingArgument, OptionParser::InvalidOption => e warn e. abort end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/vimpk/cli.rb', line 7 def command @command end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/vimpk/cli.rb', line 19 def call if @command send(@command, *@argv) exit 0 else puts @parser.parser end end |