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
|
# File 'lib/pcli/services/commands/user/show.rb', line 17
def call(*)
response = api_manager.ensure_authenticated do
spinner = SimpleSpinnerBar.start('Retrieving user...', output)
r = api.me
if r.failure?
spinner.failure
else
spinner.success
end
r
end
if response.success?
output.puts
output.puts TTY::Table.new(rows: [
[Pl.bold('ID'), response.json['id']],
[Pl.bold('Name'), response.json['name']],
[Pl.bold('Username'), response.json['username']]
]).render(:ascii)
else
output.puts
Output::ServerError.show(response, output, screen)
end
CommandOutput.continue
end
|