lib/redis-copy/cli.rb in redis-copy-0.0.2 vs lib/redis-copy/cli.rb in redis-copy-0.0.3
- old
+ new
@@ -8,12 +8,14 @@
REDIS_URI = (/\A(?:redis:\/\/)?([a-z0-9\-.]+)(:[0-9]{1,5})?(\/(?:(?:1[0-5])|[0-9]))?\z/i).freeze
DEFAULTS = {
ui: :command_line,
key_emitter: :default,
strategy: :auto,
+ pipeline: :true,
fail_fast: false,
- yes: false,
+ prompt: true,
+ trace: false,
allow_nonempty: false,
}.freeze unless defined?(DEFAULTS)
def initialize(argv = ARGV)
argv = argv.dup
@@ -42,31 +44,37 @@
)
) do |strategy|
options[:strategy] = strategy
end
- opts.on('--[no-]dry-run', 'Output configuration and exit') do |d|
- options[:dry_run] = true
+ opts.on('--[no-]pipeline',
+ "Use redis pipeline where available (default #{DEFAULTS[:pipeline]})"
+ ) do |pipeline|
+ options[:pipeline] = pipeline
end
- opts.on('-d', '--[no-]debug', 'Write debug output') do |debug|
+ opts.on('-d', '--[no-]debug', "Write debug output (default #{DEFAULTS[:debug]})") do |debug|
options[:debug] = debug
end
- opts.on('-t', '--[no-]trace', 'Enable backtrace on failure') do |trace|
+ opts.on('-t', '--[no-]trace', "Enable backtrace on failure (default #{DEFAULTS[:trace]})") do |trace|
options[:trace] = trace
end
- opts.on('-f', '--[no-]fail-fast', 'Abort on first failure') do |ff|
+ opts.on('-f', '--[no-]fail-fast', "Abort on first failure (default #{DEFAULTS[:fail_fast]})") do |ff|
options[:fail_fast] = ff
end
- opts.on('-y', '--yes', 'Automatically accept any prompts') do
- options[:yes] = true
+ opts.on('--[no-]prompt', "Prompt for confirmation (default #{DEFAULTS[:prompt]})") do
+ options[:prompt] = true
end
- opts.on('--[no-]allow-nonempty', 'Allow non-empty destination') do |allow_nonempty|
+ opts.on('--[no-]allow-nonempty', "Allow non-empty destination (default #{DEFAULTS[:allow_nonempty]})") do |allow_nonempty|
options[:allow_nonempty] = allow_nonempty
+ end
+
+ opts.on('--[no-]dry-run', 'Output configuration and exit') do |d|
+ options[:dry_run] = true
end
opts.parse!(argv)
unless argv.size == 2
opts.abort "Source and Destination must be specified\n\n" +