From 8bf133c68751080b2aeff3ee1139f28fdb873d6f Mon Sep 17 00:00:00 2001 From: Tatsuhiro Yamada Date: Fri, 11 Apr 2014 20:38:45 +0900 Subject: [PATCH] add -Q option to sched:update --- lib/td/command/sched.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/td/command/sched.rb b/lib/td/command/sched.rb index add13eca..f6bdf3be 100644 --- a/lib/td/command/sched.rb +++ b/lib/td/command/sched.rb @@ -144,6 +144,7 @@ def sched_update(op) timezone = nil delay = nil priority = nil + query = nil retry_limit = nil type = nil @@ -177,6 +178,9 @@ def sched_update(op) raise "unknown priority #{s.inspect} should be -2 (very-low), -1 (low), 0 (normal), 1 (high) or 2 (very-high)" end } + op.on('-Q', '--query PATH', 'use file instead of inline query') {|s| + query = File.open(s) { |f| f.read.strip } + } op.on('-R', '--retry COUNT', 'automatic retrying count', Integer) {|i| retry_limit = i } @@ -189,7 +193,7 @@ def sched_update(op) params = {} params['cron'] = cron if cron - params['query'] = sql if sql + params['query'] = sql || query if sql || query params['database'] = db_name if db_name params['result'] = result if result params['timezone'] = timezone if timezone