Module: CommandKit::Options::Version
- Defined in:
- lib/command_kit/options/version.rb
Overview
Defines a version option.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(command) ⇒ Object
Includes CommandKit::Options, extends ClassMethods, and defines a
-V, --versionoption.
Instance Method Summary collapse
-
#print_version ⇒ Object
Prints the version.
- #version ⇒ Object
Class Method Details
.included(command) ⇒ Object
Includes CommandKit::Options, extends ClassMethods, and defines a
-V, --version option.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/command_kit/options/version.rb', line 13 def self.included(command) command.include Options command.extend ClassMethods command.option :version, short: '-V', desc: 'Prints the version and exits' do print_version exit(0) end end |
Instance Method Details
#print_version ⇒ Object
Prints the version.
63 64 65 |
# File 'lib/command_kit/options/version.rb', line 63 def print_version puts "#{command_name} #{version}" end |
#version ⇒ Object
54 55 56 |
# File 'lib/command_kit/options/version.rb', line 54 def version self.class.version end |