allow identifier for writes. fix fight over -c
This commit is contained in:
parent
9c96e7c16b
commit
3ad1e30561
19
bin/whenever
19
bin/whenever
@ -4,32 +4,35 @@ require 'rubygems'
|
|||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'whenever'
|
require 'whenever'
|
||||||
|
|
||||||
options = Hash.new
|
options = {}
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = "Usage: whenever [options]"
|
opts.banner = "Usage: whenever [options]"
|
||||||
opts.on('-v', '--version') { puts "Whenever v#{Whenever::VERSION}"; exit(0) }
|
|
||||||
opts.on('-w', '--write-crontab') { options[:write] = true }
|
|
||||||
opts.on('-c', '--cut [lines]', 'Cut lines from the top of the cronfile') do |lines|
|
|
||||||
options[:cut] = lines.to_i if lines
|
|
||||||
end
|
|
||||||
opts.on('-i', '--update-crontab [identifier]', 'Default: full path to schedule.rb file') do |identifier|
|
opts.on('-i', '--update-crontab [identifier]', 'Default: full path to schedule.rb file') do |identifier|
|
||||||
options[:update] = true
|
options[:update] = true
|
||||||
options[:identifier] = identifier if identifier
|
options[:identifier] = identifier if identifier
|
||||||
end
|
end
|
||||||
|
opts.on('-w', '--write-crontab [identifier]', 'Default: full path to schedule.rb file') do |identifier|
|
||||||
|
options[:write] = true
|
||||||
|
options[:identifier] = identifier if identifier
|
||||||
|
end
|
||||||
opts.on('-c', '--clear-crontab [identifier]') do |identifier|
|
opts.on('-c', '--clear-crontab [identifier]') do |identifier|
|
||||||
options[:clear] = true
|
options[:clear] = true
|
||||||
options[:identifier] = identifier if identifier
|
options[:identifier] = identifier if identifier
|
||||||
end
|
end
|
||||||
|
opts.on('-s', '--set [variables]', 'Example: --set environment=staging&path=/my/sweet/path') do |set|
|
||||||
|
options[:set] = set if set
|
||||||
|
end
|
||||||
opts.on('-f', '--load-file [schedule file]', 'Default: config/schedule.rb') do |file|
|
opts.on('-f', '--load-file [schedule file]', 'Default: config/schedule.rb') do |file|
|
||||||
options[:file] = file if file
|
options[:file] = file if file
|
||||||
end
|
end
|
||||||
opts.on('-u', '--user [user]', 'Default: current user') do |user|
|
opts.on('-u', '--user [user]', 'Default: current user') do |user|
|
||||||
options[:user] = user if user
|
options[:user] = user if user
|
||||||
end
|
end
|
||||||
opts.on('-s', '--set [variables]', 'Example: --set environment=staging&path=/my/sweet/path') do |set|
|
opts.on('-k', '--cut [lines]', 'Cut lines from the top of the cronfile') do |lines|
|
||||||
options[:set] = set if set
|
options[:cut] = lines.to_i if lines
|
||||||
end
|
end
|
||||||
|
opts.on('-v', '--version') { puts "Whenever v#{Whenever::VERSION}"; exit(0) }
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
Whenever::CommandLine.execute(options)
|
Whenever::CommandLine.execute(options)
|
||||||
|
Loading…
Reference in New Issue
Block a user