pi 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +58 -56
- data/lib/cli/choose_helper.rb +69 -13
- data/lib/cli/commands/apps.rb +135 -99
- data/lib/cli/commands/dns.rb +56 -38
- data/lib/cli/commands/misc.rb +0 -1
- data/lib/cli/commands/projects.rb +6 -6
- data/lib/cli/commands/services.rb +24 -37
- data/lib/cli/commands/user.rb +3 -3
- data/lib/cli/runner.rb +32 -15
- data/lib/cli/usage.rb +78 -70
- data/lib/cli/version.rb +1 -1
- data/lib/pi/client.rb +31 -15
- metadata +4 -4
data/lib/cli/commands/dns.rb
CHANGED
@@ -32,6 +32,8 @@ module PI::Cli::Command
|
|
32
32
|
dns = client.usable_dns(appid)
|
33
33
|
err "No usable dns!" if dns.nil? || dns.empty?
|
34
34
|
if dnsname
|
35
|
+
dnsnames = dns.collect { |d| d[:name] }
|
36
|
+
err "Invalid dns name" unless dnsnames.include?(dnsname)
|
35
37
|
tmp = dnsname.split(",")
|
36
38
|
manifest = Array.new
|
37
39
|
tmp.each do |t|
|
@@ -39,11 +41,11 @@ module PI::Cli::Command
|
|
39
41
|
end
|
40
42
|
else
|
41
43
|
manifest = asks "Select dns, indexed list?", :choices => dns.collect { |d| d[:name] }, :indexed => true
|
42
|
-
display "Selected dns: ",false
|
43
|
-
manifest.each do |m|
|
44
|
-
display "#{m} ",false
|
45
|
-
end
|
46
|
-
display "\n"
|
44
|
+
#display "Selected dns: ",false
|
45
|
+
#manifest.each do |m|
|
46
|
+
#display "#{m} ",false
|
47
|
+
#end
|
48
|
+
#display "\n"
|
47
49
|
end
|
48
50
|
display "Mapping dns: ",false
|
49
51
|
|
@@ -71,11 +73,6 @@ module PI::Cli::Command
|
|
71
73
|
urls = dnsname.split(",")
|
72
74
|
else
|
73
75
|
urls = asks "Select DNS", :choices => dns, :indexed => true
|
74
|
-
display "Selected DNS: ",false
|
75
|
-
urls.each do |m|
|
76
|
-
display "#{m} ",false
|
77
|
-
end
|
78
|
-
display "\n"
|
79
76
|
end
|
80
77
|
|
81
78
|
urls.each do |url|
|
@@ -84,6 +81,7 @@ module PI::Cli::Command
|
|
84
81
|
end
|
85
82
|
|
86
83
|
def dns
|
84
|
+
client.check_login_status
|
87
85
|
dns = client.dns
|
88
86
|
return display "No Services" if dns.nil? || dns.empty?
|
89
87
|
return display JSON.pretty_generate(dns) if @options[:json]
|
@@ -98,6 +96,7 @@ module PI::Cli::Command
|
|
98
96
|
end
|
99
97
|
|
100
98
|
def zones
|
99
|
+
client.check_login_status
|
101
100
|
zones = client.dns_zone_list
|
102
101
|
return display JSON.pretty_generate(zones) if @options[:json]
|
103
102
|
return display "No DNS!" if zones.nil? || zones.empty?
|
@@ -111,9 +110,15 @@ module PI::Cli::Command
|
|
111
110
|
end
|
112
111
|
|
113
112
|
def create_dns(dnsname=nil)
|
113
|
+
client.check_login_status
|
114
114
|
projectid = @options[:projectid]
|
115
115
|
description = @options[:desc]
|
116
116
|
zoneid = @options[:zoneid]
|
117
|
+
if dnsname
|
118
|
+
if not check_name_valid?(dnsname)
|
119
|
+
err "Invalid dns name '#{dnsname}'."
|
120
|
+
end
|
121
|
+
end
|
117
122
|
dns_zone = client.dns_zone_list
|
118
123
|
err"No dns zone" if dns_zone.nil? || dns_zone.empty?
|
119
124
|
if zoneid
|
@@ -123,6 +128,7 @@ module PI::Cli::Command
|
|
123
128
|
end
|
124
129
|
err"The dns zone id is not exist!" if zoneid_flag != true
|
125
130
|
end
|
131
|
+
|
126
132
|
projects = client.projects
|
127
133
|
projectname = ask"Project name", :choices => projects.collect { |p| p[:name] }, :indexed => true unless projectid
|
128
134
|
projects.each do |p|
|
@@ -165,6 +171,7 @@ module PI::Cli::Command
|
|
165
171
|
end
|
166
172
|
|
167
173
|
def delete_dns(dnsid=nil)
|
174
|
+
client.check_login_status
|
168
175
|
unless dnsid
|
169
176
|
dnsid = choose_dnsid
|
170
177
|
end
|
@@ -173,23 +180,33 @@ module PI::Cli::Command
|
|
173
180
|
end
|
174
181
|
|
175
182
|
def register_dns(dnsid=nil)
|
183
|
+
client.check_login_status
|
184
|
+
target = @options[:target]
|
185
|
+
continent = @options[:continent]
|
186
|
+
country = @options[:country]
|
176
187
|
unless dnsid
|
177
188
|
dnsid = choose_dnsid
|
178
189
|
end
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
190
|
+
unless target
|
191
|
+
targets = client.usable_dns_target(dnsid)
|
192
|
+
target = ask"Select target", :choices => targets.collect { |t| t[:targetName] }, :indexed => true
|
193
|
+
end
|
194
|
+
unless continent
|
195
|
+
continents = client.dns_continents
|
196
|
+
tmp = continents.values
|
197
|
+
tmp.sort! {|a, b| a <=> b }
|
198
|
+
continent = ask"Select continent", :choices => tmp.collect { |t| t }, :indexed => true
|
199
|
+
display "Select continent: #{continent}"
|
200
|
+
continent = continents.invert["#{continent}"]
|
201
|
+
end
|
202
|
+
unless country
|
203
|
+
countries = client.dns_country(continent)
|
204
|
+
tmp = countries.values
|
205
|
+
tmp.sort! {|a, b| a <=> b }
|
206
|
+
country = ask"Select country", :choices => tmp.collect { |t| t }, :indexed => true
|
207
|
+
display "Select country: #{country}"
|
208
|
+
country = countries.invert["#{country}"]
|
209
|
+
end
|
193
210
|
manifest = {
|
194
211
|
:continentName => continent,
|
195
212
|
:countryCode => country
|
@@ -199,24 +216,25 @@ module PI::Cli::Command
|
|
199
216
|
end
|
200
217
|
|
201
218
|
def deregister_dns(dnsid=nil)
|
219
|
+
client.check_login_status
|
220
|
+
recordid = @options[:recordid]
|
202
221
|
unless dnsid
|
203
222
|
dnsid = choose_dnsid
|
204
223
|
end
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
224
|
+
unless recordid
|
225
|
+
targets = client.usable_dns_target(dnsid)
|
226
|
+
target = ask"Select target", :choices => targets.collect { |t| t[:targetName] }, :indexed => true
|
227
|
+
record = Array.new
|
228
|
+
targets.each do |t|
|
229
|
+
record = t[:records] if t[:targetName] == target
|
230
|
+
end
|
231
|
+
err"No record" if record.nil? || record.empty?
|
232
|
+
view = ask"Select record", :choices => record.collect { |t| t[:view] }, :indexed => true
|
233
|
+
recordid = nil
|
234
|
+
record.each do |r|
|
235
|
+
recordid = r[:id] if r[:view] == view
|
236
|
+
end
|
218
237
|
end
|
219
|
-
|
220
238
|
client.deregister_dns(recordid)
|
221
239
|
display "OK".green
|
222
240
|
end
|
data/lib/cli/commands/misc.rb
CHANGED
@@ -176,18 +176,18 @@ module PI::Cli::Command
|
|
176
176
|
java_projects.sort! {|a, b| a[:name] <=> b[:name] }
|
177
177
|
if projectid
|
178
178
|
flag = nil
|
179
|
-
java_projects.each do |j|
|
180
|
-
flag = true if projectid == j[:id]
|
179
|
+
java_projects.each do |j|
|
180
|
+
flag = true if projectid == j[:id].to_s
|
181
181
|
end
|
182
|
-
err "The project is not found or not a java project! " unless flag
|
182
|
+
err "The project is not found or not a java project! " unless flag
|
183
183
|
else
|
184
184
|
project = ask "Select Project", :choices => java_projects.collect { |j| j[:name] }, :indexed => true
|
185
185
|
display "Selected Project: ",false
|
186
186
|
display "#{project}"
|
187
|
+
project = client.project_search(project)
|
188
|
+
projectid = project[:id]
|
187
189
|
end
|
188
|
-
|
189
|
-
projectid = project[:id]
|
190
|
-
|
190
|
+
|
191
191
|
if version
|
192
192
|
tmp = client.project_binary_existed(projectid, version)
|
193
193
|
err "Version '#{version}' already exists." if tmp.include?("true")
|
@@ -29,6 +29,8 @@ module PI::Cli::Command
|
|
29
29
|
err "No usable services!" if services.nil? || services.empty?
|
30
30
|
|
31
31
|
if service
|
32
|
+
servicenames = services.collect { |s| s[:name] }
|
33
|
+
err "Invalid service name" unless servicenames.include?(service)
|
32
34
|
tmp = service.split(",")
|
33
35
|
manifest = Array.new
|
34
36
|
tmp.each do |s|
|
@@ -36,13 +38,9 @@ module PI::Cli::Command
|
|
36
38
|
end
|
37
39
|
else
|
38
40
|
manifest = asks "Select services, indexed list?", :choices => services.collect { |s| s[:name] }, :indexed => true
|
39
|
-
display "Selected services: ",false
|
40
|
-
manifest.each do |m|
|
41
|
-
display "#{m} ",false
|
42
|
-
end
|
43
|
-
display "\n"
|
44
41
|
end
|
45
|
-
|
42
|
+
graceful = get_graceful(app)
|
43
|
+
lazy = get_lazy(app)
|
46
44
|
display "Binding service: ",false
|
47
45
|
|
48
46
|
t = Thread.new do
|
@@ -53,18 +51,10 @@ module PI::Cli::Command
|
|
53
51
|
end
|
54
52
|
end
|
55
53
|
|
56
|
-
client.bind_service(appid,manifest)
|
57
|
-
|
54
|
+
tmp = client.bind_service(appid, graceful, lazy, manifest)
|
55
|
+
uuid = tmp[1]
|
56
|
+
result = check_status(uuid)
|
58
57
|
Thread.kill(t)
|
59
|
-
if result[:code] == 200
|
60
|
-
if not result[:text].empty?
|
61
|
-
display "OK".green
|
62
|
-
else
|
63
|
-
display "Time out"
|
64
|
-
end
|
65
|
-
else
|
66
|
-
err result[:text]
|
67
|
-
end
|
68
58
|
end
|
69
59
|
|
70
60
|
def unbind_service(appid_or_appname=nil)
|
@@ -78,19 +68,16 @@ module PI::Cli::Command
|
|
78
68
|
services = service.split(",")
|
79
69
|
else
|
80
70
|
services = asks "Select Service", :choices => services.collect { |s| s[:name] }, :indexed => true
|
81
|
-
display "Selected DNS: ",false
|
82
|
-
services.each do |m|
|
83
|
-
display "#{m} ",false
|
84
|
-
end
|
85
|
-
display "\n"
|
86
71
|
end
|
87
|
-
|
72
|
+
graceful = get_graceful(app)
|
73
|
+
lazy = get_lazy(app)
|
88
74
|
services.each do |service|
|
89
|
-
do_unbind_service(app, service)
|
75
|
+
do_unbind_service(app, service, graceful, lazy)
|
90
76
|
end
|
91
77
|
end
|
92
78
|
|
93
79
|
def services
|
80
|
+
client.check_login_status
|
94
81
|
services = client.services
|
95
82
|
return display "No Services" if services.nil? || services.empty?
|
96
83
|
return display JSON.pretty_generate(services) if @options[:json]
|
@@ -105,6 +92,7 @@ module PI::Cli::Command
|
|
105
92
|
end
|
106
93
|
|
107
94
|
def service(serviceid=nil)
|
95
|
+
client.check_login_status
|
108
96
|
if serviceid
|
109
97
|
services = client.services
|
110
98
|
err "No services" if services.nil? || services.empty?
|
@@ -123,20 +111,24 @@ module PI::Cli::Command
|
|
123
111
|
end
|
124
112
|
|
125
113
|
def import_service(importurl=nil)
|
114
|
+
client.check_login_status
|
126
115
|
importurl = ask"Input the url to import" unless importurl
|
127
116
|
client.import_service(importurl)
|
128
117
|
display"OK".green
|
129
118
|
end
|
130
119
|
|
131
120
|
def export_service(serviceid=nil)
|
121
|
+
client.check_login_status
|
132
122
|
unless serviceid
|
133
123
|
serviceid = choose_serviceid
|
134
124
|
end
|
135
|
-
serviceurl = client.export_service(serviceid)
|
125
|
+
serviceurl = client.export_service(serviceid)
|
126
|
+
display "The exported URL of service:"
|
136
127
|
display "#{serviceurl[1]}"
|
137
128
|
end
|
138
129
|
|
139
130
|
def check_service(serviceid=nil)
|
131
|
+
client.check_login_status
|
140
132
|
unless serviceid
|
141
133
|
serviceid = choose_serviceid
|
142
134
|
end
|
@@ -149,6 +141,7 @@ module PI::Cli::Command
|
|
149
141
|
end
|
150
142
|
|
151
143
|
def delete_service(serviceid=nil)
|
144
|
+
client.check_login_status
|
152
145
|
unless serviceid
|
153
146
|
serviceid = choose_serviceid
|
154
147
|
end
|
@@ -157,6 +150,7 @@ module PI::Cli::Command
|
|
157
150
|
end
|
158
151
|
|
159
152
|
def register_service(serviceid=nil)
|
153
|
+
client.check_login_status
|
160
154
|
target = @options[:target]
|
161
155
|
servicetype = @options[:type]
|
162
156
|
if servicetype
|
@@ -198,6 +192,7 @@ module PI::Cli::Command
|
|
198
192
|
end
|
199
193
|
|
200
194
|
def deregister_service(serviceid=nil)
|
195
|
+
client.check_login_status
|
201
196
|
servicetargetname = @options[:target]
|
202
197
|
unless serviceid
|
203
198
|
serviceid = choose_serviceid
|
@@ -218,7 +213,7 @@ module PI::Cli::Command
|
|
218
213
|
|
219
214
|
private
|
220
215
|
|
221
|
-
def do_unbind_service(app, service)
|
216
|
+
def do_unbind_service(app, service, graceful, lazy)
|
222
217
|
display "Unbinding service '#{service}': ",false
|
223
218
|
t = Thread.new do
|
224
219
|
loop do
|
@@ -227,18 +222,10 @@ module PI::Cli::Command
|
|
227
222
|
break unless t.alive?
|
228
223
|
end
|
229
224
|
end
|
230
|
-
client.unbind_service(app[:id], service)
|
231
|
-
|
225
|
+
tmp = client.unbind_service(app[:id], service, graceful, lazy)
|
226
|
+
uuid = tmp[1]
|
227
|
+
result = check_status(uuid)
|
232
228
|
Thread.kill(t)
|
233
|
-
if result[:code] == 200
|
234
|
-
if not result[:text].empty?
|
235
|
-
display "OK".green
|
236
|
-
else
|
237
|
-
display "Time out"
|
238
|
-
end
|
239
|
-
else
|
240
|
-
err result[:text]
|
241
|
-
end
|
242
229
|
end
|
243
230
|
|
244
231
|
end
|
data/lib/cli/commands/user.rb
CHANGED
@@ -20,14 +20,14 @@ module PI::Cli::Command
|
|
20
20
|
url = "#{target_url}" if url.nil? || url.empty?
|
21
21
|
eval("PI::Cli::Command::Misc").new().send("set_target", url)
|
22
22
|
unless client.target_valid?
|
23
|
-
display "Host is not available or is not valid: '#{
|
24
|
-
display "\n<<<\n#{client.raw_info}\n>>>\n"
|
23
|
+
display "Host is not available or is not valid: '#{url}'".red
|
24
|
+
display "\n<<<\n#{client.raw_info}\n>>>\n"
|
25
25
|
exit(false)
|
26
26
|
end
|
27
27
|
|
28
28
|
tries ||= 0
|
29
29
|
user = ask "User" unless user
|
30
|
-
password = ask "Password", :echo => '*' unless password
|
30
|
+
password = ask "Password", :echo => '*' unless password
|
31
31
|
login_and_save_token(user, password)
|
32
32
|
say "Successfully logged into [#{target_url}]".green
|
33
33
|
rescue PI::Client::TargetError
|
data/lib/cli/runner.rb
CHANGED
@@ -25,7 +25,7 @@ class PI::Cli::Runner
|
|
25
25
|
opts_parser = OptionParser.new do |opts|
|
26
26
|
opts.banner = "\nAvailable options:\n\n"
|
27
27
|
|
28
|
-
opts.on('--url URL') { |url| @options[:url] = url }
|
28
|
+
# opts.on('--url URL') { |url| @options[:url] = url }
|
29
29
|
opts.on('--user USER') { |user| @options[:user] = user }
|
30
30
|
opts.on('--password PASS') { |pass| @options[:password] = pass }
|
31
31
|
opts.on('--name NAME') { |name| @options[:name] = name }
|
@@ -41,9 +41,13 @@ class PI::Cli::Runner
|
|
41
41
|
opts.on('--service SERVICE') { |service| @options[:service] = service }
|
42
42
|
opts.on('--dns DNS') { |dns| @options[:dns] = dns }
|
43
43
|
opts.on('--zoneid ID') { |id| @options[:zoneid] = id }
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
opts.on('--instanceid N') { |inst| @options[:instanceid] = inst }
|
45
|
+
opts.on('--file FILE') { |file| @options[:file] = file }
|
46
|
+
opts.on('--continent CONT') { |cont| @options[:continent] = cont }
|
47
|
+
opts.on('--country COUNTRY') { |country| @options[:country] = country }
|
48
|
+
opts.on('--recordid ID') { |id| @options[:recordid] = id }
|
49
|
+
opts.on('--graceful') { @options[:graceful] = true }
|
50
|
+
opts.on('--lazy') { @options[:lazy] = true }
|
47
51
|
# generic tracing and debugging
|
48
52
|
opts.on('-t [TKEY]') { |tkey| @options[:trace] = tkey || true }
|
49
53
|
opts.on('--trace [TKEY]') { |tkey| @options[:trace] = tkey || true }
|
@@ -96,8 +100,8 @@ class PI::Cli::Runner
|
|
96
100
|
return if @namespace && @action
|
97
101
|
|
98
102
|
# @help_only = false
|
99
|
-
|
100
|
-
verb = @args.shift
|
103
|
+
|
104
|
+
verb = @args.shift
|
101
105
|
case verb
|
102
106
|
|
103
107
|
###############################################################################
|
@@ -230,19 +234,19 @@ class PI::Cli::Runner
|
|
230
234
|
set_cmd(:apps, :start_app, @args.size == 1 ? 1 : 0)
|
231
235
|
|
232
236
|
when 'stop-app'
|
233
|
-
usage('pi stop-app [appid] or pi stop-app <appname> <--target TARGET>')
|
237
|
+
usage('pi stop-app [appid] [--graceful] or pi stop-app <appname> <--target TARGET> [--graceful]')
|
234
238
|
set_cmd(:apps, :stop_app, @args.size == 1 ? 1 : 0)
|
235
239
|
|
236
240
|
when 'restart-app'
|
237
|
-
usage('pi restart-app [appid] or pi restart-app <appname> <--target TARGET>')
|
241
|
+
usage('pi restart-app [appid] [--graceful] [--lazy] or pi restart-app <appname> <--target TARGET> [--graceful] [--lazy]')
|
238
242
|
set_cmd(:apps, :restart_app, @args.size == 1 ? 1 : 0)
|
239
243
|
|
240
244
|
when 'scale-app'
|
241
|
-
usage('pi scale-app [appid] [--instance N] or pi scale-app <appname> <--target TARGET> [--instance N]')
|
245
|
+
usage('pi scale-app [appid] [--instance N] [--graceful] or pi scale-app <appname> <--target TARGET> [--instance N] [--graceful]')
|
242
246
|
set_cmd(:apps, :scale_app, @args.size == 1 ? 1 : 0)
|
243
247
|
|
244
248
|
when 'update-app'
|
245
|
-
usage('pi update-app [appid] [--ver VERSION] or pi update-app <appname> <--target TARGET> [--ver VERSION]')
|
249
|
+
usage('pi update-app [appid] [--ver VERSION] [--graceful] [--lazy] or pi update-app <appname> <--target TARGET> [--ver VERSION][--graceful] [--lazy]')
|
246
250
|
set_cmd(:apps, :update_app, @args.size == 1 ? 1 : 0)
|
247
251
|
|
248
252
|
when 'status'
|
@@ -262,8 +266,12 @@ class PI::Cli::Runner
|
|
262
266
|
set_cmd(:apps, :delete_env, @args.size == 1 ? 1 : 0)
|
263
267
|
|
264
268
|
when 'app-log'
|
265
|
-
usage('pi app-log [appid] or pi app-log <appname> <--target TARGET>')
|
269
|
+
usage('pi app-log [appid] [--instanceid,--file] or pi app-log <appname> <--target TARGET> [--instanceid,--file]')
|
266
270
|
set_cmd(:apps, :app_log, @args.size == 1 ? 1 : 0)
|
271
|
+
|
272
|
+
when 'app-debug'
|
273
|
+
usage('pi app-debug [appid] or pi app-log <appname> <--target TARGET>')
|
274
|
+
set_cmd(:apps, :app_debug, @args.size == 1 ? 1 : 0)
|
267
275
|
|
268
276
|
###############################################################################
|
269
277
|
# Services
|
@@ -274,11 +282,11 @@ class PI::Cli::Runner
|
|
274
282
|
set_cmd(:services, :app_service, @args.size == 1 ? 1 : 0)
|
275
283
|
|
276
284
|
when 'bind-service'
|
277
|
-
usage('pi bind-service [appid] [--service SERVICE] or pi bind-service <appname> <--target TARGET> [--service SERVICE]')
|
285
|
+
usage('pi bind-service [appid] [--service SERVICE] [--graceful] [--lazy] or pi bind-service <appname> <--target TARGET> [--service SERVICE] [--graceful] [--lazy]')
|
278
286
|
set_cmd(:services, :bind_service, @args.size == 1 ? 1 : 0)
|
279
287
|
|
280
288
|
when 'unbind-service'
|
281
|
-
usage('pi unbind-service [appid] [--service SERVICE] or pi unbind-service <appname> <--target TARGET> [--service SERVICE]')
|
289
|
+
usage('pi unbind-service [appid] [--service SERVICE] [--graceful] [--lazy] or pi unbind-service <appname> <--target TARGET> [--service SERVICE] [--graceful] [--lazy]')
|
282
290
|
set_cmd(:services, :unbind_service, @args.size == 1 ? 1 : 0)
|
283
291
|
|
284
292
|
when 'services'
|
@@ -346,11 +354,11 @@ class PI::Cli::Runner
|
|
346
354
|
set_cmd(:dns, :delete_dns, @args.size == 1 ? 1 : 0)
|
347
355
|
|
348
356
|
when 'register-dns'
|
349
|
-
usage('pi register-dns [dnsid]')
|
357
|
+
usage('pi register-dns [dnsid] [--target,--continent,--country]')
|
350
358
|
set_cmd(:dns, :register_dns, @args.size == 1 ? 1 : 0)
|
351
359
|
|
352
360
|
when 'deregister-dns'
|
353
|
-
usage('pi deregister-dns [dnsid]')
|
361
|
+
usage('pi deregister-dns [dnsid] [--recordid ID]')
|
354
362
|
set_cmd(:dns, :deregister_dns, @args.size == 1 ? 1 : 0)
|
355
363
|
|
356
364
|
###############################################################################
|
@@ -409,11 +417,20 @@ class PI::Cli::Runner
|
|
409
417
|
end
|
410
418
|
|
411
419
|
rescue OptionParser::InvalidOption => e
|
420
|
+
puts(e.message.red)
|
421
|
+
puts("\n")
|
422
|
+
puts(basic_usage)
|
423
|
+
@exit_status = false
|
412
424
|
rescue OptionParser::AmbiguousOption => e
|
413
425
|
puts(e.message.red)
|
414
426
|
puts("\n")
|
415
427
|
puts(basic_usage)
|
416
428
|
@exit_status = false
|
429
|
+
rescue OptionParser::MissingArgument => e
|
430
|
+
puts(e.message.red)
|
431
|
+
puts("\n")
|
432
|
+
puts(basic_usage)
|
433
|
+
@exit_status = false
|
417
434
|
rescue PI::Client::AuthError => e
|
418
435
|
if PI::Cli::Config.auth_token.nil?
|
419
436
|
puts "Login Required".red
|