class Gitclean::ScriptOptions

Attributes

exemptions[RW]

Public Class Methods

new() click to toggle source
# File lib/gitclean/script_options.rb, line 7
def initialize
  self.exemptions = ["master", "develope", "staging"]
end

Public Instance Methods

define_options(parser) click to toggle source
# File lib/gitclean/script_options.rb, line 11
def define_options(parser)
  parser.banner = "Usage: run.rb [options]"
  parser.separator ""
  parser.separator "Specific options:"

  # add additional options
  exemption_list_option(parser)

  parser.separator ""
  parser.separator "Common options:"
  # No argument, shows at tail.  This will print an options summary.
  # Try it and see!
  parser.on_tail("-h", "--help", "Show this message") do
    puts parser
    exit
  end
  # Another typical switch to print the version.
  parser.on_tail("--version", "Show version") do
    puts "GitClean CLI version #{VERSION}"
    exit
  end
end
exemption_list_option(parser) click to toggle source
# File lib/gitclean/script_options.rb, line 34
def exemption_list_option(parser)
  # List of arguments.
  parser.on("--exemption x,y,z", Array, "Items which should not be deleted") do |list|
    self.exemptions = list
  end
end