lib/glyptodont/options.rb in glyptodont-0.2.0 vs lib/glyptodont/options.rb in glyptodont-0.3.0
- old
+ new
@@ -5,11 +5,11 @@
require "optparse"
module Glyptodont
# Command-line options for the tool
class Options
- attr_reader :directory, :threshold, :max_age_in_days
+ attr_reader :directory, :threshold, :max_age_in_days, :keywords
def initialize(args)
@args = args
@directory = "."
parse
@@ -22,10 +22,11 @@
opts.banner = "Usage: #{opts.program_name} [options]"
directory_option(opts)
threshold_option(opts)
max_age_in_days_option(opts)
+ keywords_option(opts)
version_option(opts)
end.parse!(@args)
end
def directory_option(opts)
@@ -41,9 +42,18 @@
end
def max_age_in_days_option(opts)
opts.on("-m", "--max-age DAYS", Integer, "Maximum number of days to allow TODOs to stay (default 14)") do |m|
@max_age_in_days = m
+ end
+ end
+
+ def keywords_option(opts)
+ opts.on("-k",
+ "--keywords TODO,WORDS",
+ Array,
+ "Keywords to treat as 'TODO' (default FIXME,HACK,TODO,XXX)") do |k|
+ @keywords = k
end
end
def version_option(opts)
opts.on_tail("--version", "Show version") do