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
|
# File 'lib/bootprint/cli.rb', line 26
def run
command = @argv.shift
case command
when "capture" then capture
when "diff" then diff
when "diagnose" then diagnose
when "doctor" then doctor
when "verify" then verify
when "fix" then fix
when "policy" then policy_command
when "snapshot" then snapshot_command
when "docker" then docker_command
when "ci" then ci_command
when "security" then security_command
when "version", "--version", "-v" then version
when "help", "--help", "-h", nil then help(EXIT_OK)
else
@err.puts "Unknown command: #{command}"
help(EXIT_CONFIG)
end
rescue InvalidSnapshotError => error
@err.puts "bootprint: #{error.message}"
EXIT_SNAPSHOT
rescue OptionParser::ParseError, ConfigurationError => error
@err.puts "bootprint: #{error.message}"
EXIT_CONFIG
rescue DockerError, PluginError, Errno::EACCES, Errno::ENOENT => error
@err.puts "bootprint: #{error.message}"
EXIT_INTERNAL
rescue StandardError => error
@err.puts "bootprint: internal error: #{error.class}: #{Sanitizer.text(error.message)}"
@err.puts error.backtrace if ENV["BOOTPRINT_DEBUG"] == "1"
EXIT_INTERNAL
end
|