Class: Supermarket::SupermarketCLI
Class Method Summary
collapse
Instance Method Summary
collapse
exec_options, profile_options, target_options
Class Method Details
.banner(command, _namespace = nil, _subcommand = false) ⇒ Object
10
11
12
|
# File 'lib/bundles/inspec-supermarket/cli.rb', line 10
def self.banner(command, _namespace = nil, _subcommand = false)
"#{basename} #{subcommand_prefix} #{command.usage}"
end
|
.subcommand_prefix ⇒ Object
14
15
16
|
# File 'lib/bundles/inspec-supermarket/cli.rb', line 14
def self.subcommand_prefix
namespace
end
|
Instance Method Details
#exec(*tests) ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/bundles/inspec-supermarket/cli.rb', line 31
def exec(*tests)
tests = tests.map { |t| 'supermarket://' + t }
diagnose
run_tests(tests, opts)
end
|
#info(profile) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/bundles/inspec-supermarket/cli.rb', line 41
def info(profile)
supermarket_profiles = Supermarket::API.profiles
found = supermarket_profiles.select { |p|
"#{p['tool_owner']}/#{p['slug']}" == profile
}
if found.empty?
puts "#{mark_text(profile)} is not available on Supermarket"
return
end
info = Supermarket::API.info(profile)
puts "#{mark_text('name: ')} #{info['slug']}"
puts "#{mark_text('owner:')} #{info['owner']}"
puts "#{mark_text('url: ')} #{info['source_url']}"
puts
puts "#{mark_text('description: ')} #{info['description']}"
end
|
#profiles ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/bundles/inspec-supermarket/cli.rb', line 19
def profiles
supermarket_profiles = Supermarket::API.profiles
headline('Available profiles:')
supermarket_profiles.each { |p|
li("#{p['tool_name']} #{mark_text(p['tool_owner'] + '/' + p['slug'])}")
}
end
|