Class: Options
- Inherits:
-
Object
- Object
- Options
- Defined in:
- lib/directory_monitor/options.rb
Class Method Summary collapse
-
.parse ⇒ Object
Use trollop to handle all our options switches and verify we have some sort of shell-command specified on the command-line.
Class Method Details
.parse ⇒ Object
Use trollop to handle all our options switches and verify we have some sort of shell-command specified on the command-line.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/directory_monitor/options.rb', line 41 def self.parse opts = Trollop:: do version "#{Version}" Banner.gsub(/^#{Banner[/^ +/, 0]}/, "") opt :suffix, "Regex selecting the files being watched", :default => ".*" opt :delay, "Seconds to sleep between watches", :default => 5.0 opt :loop, "Execute individual command for each file" opt :force, "Force a first exectuion on all watched files" opt :token, "String used for file name substitution", :default => "%%" opt :verbose, "Print command on standard output", :short => "V" end Trollop::die "shell command is required" if ARGV.empty? opts[:shell_command] = ARGV.join(" ") opts end |