12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/prize/cli.rb', line 12
def parse_options!
@options = OpenStruct.new
OptionParser.new do |opts|
opts.banner = <<~EOF
Usage: prize [options]
EOF
opts.on('-uURL', '--url=URL', 'Server URL, for a TCP connection: `redis://:[password]@[hostname]:[port]/[db]` (password, port and database are optional), for a unix socket connection: `unix://[path to Redis socket]`. This overrides all other options.') do |url|
@options.url = url
end
opts.on('-hHOST', '--host=HOST', 'Server hostname (default: 127.0.0.1)') do |host|
@options.host = host
end
opts.on('-pPORT', '--port=PORT', 'Server port (default: 6379)') do |port|
@options.port = port.to_i
end
opts.on('-sPATH', '--sock=PATH', 'Server socket (overrides hostname and port)') do |path|
@options.path = path
end
opts.on('-dDB', '--db=DB', 'Specify database') do |db|
@options.db = db
end
opts.on('-PPASSWORD', '--password=PASSWORD', 'Specify password') do |password|
@options.password = password
end
opts.on('', '--timeout=TIMEOUT', 'Timeout in seconds (default: 5.0)') do |timeout|
@options.timeout = timeout.to_i
end
opts.on('', '--connect-timeout=TIMEOUT', 'Timeout for initial connect in seconds (default: same as timeout)') do |timeout|
@options.connect_timeout = timeout.to_i
end
opts.on('', '--replica', 'Whether to use readonly replica nodes in Redis Cluster or not') do
@options.replica = true
end
opts.on('', '--cluster=CLUSTER_URL', 'List of cluster nodes to contact, format: URL1,URL2,URL3...') do |cluster|
@options.cluster = cluster.split(',')
end
opts.on('-HSSH_HOST', '--ssh-host=SSH_HOST', 'Specify SSH host') do |ssh_host|
@options.ssh_host = ssh_host
end
opts.on('-OSSH_PORT', '--ssh-port=SSH_PORT', 'Specify SSH port') do |ssh_port|
@options.ssh_port = ssh_port.to_i
end
opts.on('-USSH_USER', '--ssh-user=SSH_USER', 'Specify SSH user') do |ssh_user|
@options.ssh_user = ssh_user
end
opts.on('-WSSH_PASSWORD', '--ssh-password=SSH_PASSWORD', 'Specify SSH password') do |ssh_password|
@options.ssh_password = ssh_password
end
opts.on('-LSSH_LOCAL_PORT', '--ssh-local-port=SSH_LOCAL_PORT', 'Specify local SSH proxy port') do |local_port|
@options.ssh_local_port = local_port.to_i
end
opts.on('-ECODE', '--eval=CODE', 'evaluate CODE') do |code|
@options.code = code
end
opts.on('-V', '--version', 'Prints version') do
puts "PRIZE #{Prize::VERSION}"
exit
end
opts.on('', '--help', 'Prints this help') do
puts opts
exit
end
end.parse!
@options.args = ARGV
end
|