Sha256: 7fec93fb20fd9110c07926a4b1bab8b8a59e0959d0e608cdf044058e5b5be819
Contents?: true
Size: 1.12 KB
Versions: 10
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby # # Created on 2008-5-11. # Copyright (c) 2008. All rights reserved. begin require 'rubygems' rescue LoadError # no rubygems to load, so we fail silently end require 'optparse' # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application. OPTIONS = { :path => '~' } MANDATORY_OPTIONS = %w( ) parser = OptionParser.new do |opts| opts.banner = <<BANNER This application is wonderful because... Usage: #{File.basename($0)} [options] Options are: BANNER opts.separator "" opts.on("-p", "--path=PATH", String, "The root path for selecting files", "Default: ~") { |path| OPTIONS[:path] = path} opts.on("-h", "--help", "Show this help message.") { puts opts; exit } opts.parse!(ARGV) if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? } puts opts; exit end end path = OPTIONS[:path] autotest_file = File.expand_path(path) + "/.autotest" if File.exist?(autotest_file) File.delete(autotest_file) puts "\nYou no longer receive notifications of your tests." puts "" # a blank line end
Version data entries
10 entries across 10 versions & 3 rubygems