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
|
# File 'lib/cyclid/cli/organization/config.rb', line 22
def show(type, plugin)
plugin_data = client.org_config_get(client.config.organization, type, plugin)
config = plugin_data['config']
schema = plugin_data['schema']
schema.each do |setting|
name = setting['name']
type = setting['type']
case type
when 'string', 'integer'
data = config[name] || 'Not set'
Formatter.colorize setting['description'], data
when 'password'
data = config[name] ? '*' * config[name].length : 'Not set'
Formatter.colorize setting['description'], data
when 'boolean'
data = config[name] || 'Not set'
Formatter.colorize setting['description'], (data ? 'true' : 'false')
when 'list'
Formatter.colorize setting['description']
data = config[name]
if data.empty?
Formatter.puts "\tNone"
else
data.each do |item|
Formatter.puts "\t#{item}"
end
end
when 'hash-list'
Formatter.colorize setting['description']
data = config[name]
if data.empty?
Formatter.puts "\tNone"
else
data.each do |item|
item.each do |k, v|
Formatter.puts "\t#{k}: #{v}"
end
end
end
end
end
rescue StandardError => ex
abort "Failed to get plugin configuration: #{ex}"
end
|