Skip to content

Commit

Permalink
Introduced --version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
codecircuit committed May 15, 2019
1 parent 9adc9d9 commit e214cdc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ task :install, [:install_d,:man_d] => [:default] do |task,args|
"math.rb",
"regular-expressions.rb",
"minstructor.rb",
"version.rb"
"mcollector.rb",
"mcollector-modules/akav.rb",
"mcollector-modules/kav.rb",
Expand Down
6 changes: 6 additions & 0 deletions mcollector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

require_relative './mcollector-modules/available-modules.rb'
require_relative './math.rb'
require_relative './version.rb'

def parse_hash(str)
begin
Expand Down Expand Up @@ -125,6 +126,11 @@ def self.parse(args)
options.debug = d
end

opts.on_tail("--version", "show version") do |v|
puts $VERSION
exit
end

end
opt_parser.set_summary_indent(" ")
opt_parser.set_summary_width(25)
Expand Down
6 changes: 6 additions & 0 deletions minstructor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'progressbar'

require_relative './math.rb'
require_relative './version.rb'

class OptPrs

Expand Down Expand Up @@ -107,6 +108,11 @@ def self.parse(args)
options.dry = dr
end

opts.on_tail("--version", "show version") do |v|
puts $VERSION
exit
end

end

opt_parser.set_summary_indent(" ")
Expand Down
1 change: 1 addition & 0 deletions version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$VERSION = "2.0"

0 comments on commit e214cdc

Please sign in to comment.