lib/everyday-cli-utils/option.rb in everyday-cli-utils-1.3.0 vs lib/everyday-cli-utils/option.rb in everyday-cli-utils-1.4.0
- old
+ new
@@ -82,16 +82,22 @@
@opts ||= OptionParser.new
@opts.banner = banner
end
def help
- @opts ||= OptionParser.new
- @opts.help
+ @opts ||= OptionParser.new
+ @help_str ||= nil
+ @help_str.nil? ? @opts.help : @help_str
end
def to_s
- @opts ||= OptionParser.new
- @opts.to_s
+ @opts ||= OptionParser.new
+ @help_str ||= nil
+ @help_str.nil? ? @opts.to_s : @help_str
+ end
+
+ def help_str=(str)
+ @help_str = str
end
def parse!(argv = ARGV)
@opts ||= OptionParser.new
default_options YAML::load_file(@defaults_file) unless @defaults_file.nil? || !File.exist?(@defaults_file)
\ No newline at end of file