module CommandKit::Options::Version
Defines a version option.
Public Class Methods
included(command)
click to toggle source
Includes {Options}, extends {Version::ClassMethods}, and defines a `-V, –version` option.
# 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
Public Instance Methods
print_version()
click to toggle source
Prints the version.
@api public
# File lib/command_kit/options/version.rb, line 63 def print_version puts "#{command_name} #{version}" end
version()
click to toggle source
@see ClassMethods#version
@api public
# File lib/command_kit/options/version.rb, line 54 def version self.class.version end