Class: Straycall::CLI
- Inherits:
-
Object
- Object
- Straycall::CLI
- Defined in:
- lib/straycall/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
13 14 15 16 |
# File 'lib/straycall/cli.rb', line 13 def initialize(argv) @argv = argv.dup @config_actions = [] end |
Class Method Details
.start(argv = ARGV) ⇒ Object
9 10 11 |
# File 'lib/straycall/cli.rb', line 9 def self.start(argv = ARGV) new(argv).run end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/straycall/cli.rb', line 18 def run parse! unless Straycall.available? Straycall.warn_unavailable! return exec(*@argv) end require "seccomp/notify" require_relative "supervisor" status, violations = Supervisor.new(Straycall.config).run(@argv) if Straycall.config.on_violation == :record require_relative "recorder" Recorder.new(@policy_path, force: @force).write(violations) end return 1 if violations.any? { |violation| violation.action == :denied } child_exit_code(status) rescue OptionParser::ParseError, ConfigurationError => error warn "straycall: #{error.}" 64 end |