Class: SeccompTools::CLI::Disasm
- Defined in:
- lib/seccomp-tools/cli/disasm.rb
Overview
Handle ‘disasm’ command.
Constant Summary collapse
- SUMMARY =
Summary of this command.
'Disassemble seccomp bpf.'- USAGE =
Usage of this command.
"disasm - #{SUMMARY}\n\nUsage: seccomp-tools disasm BPF_FILE [options]"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#handle ⇒ void
Handle options.
-
#parser ⇒ OptionParser
Define option parser.
Methods inherited from Base
Constructor Details
This class inherits a constructor from SeccompTools::CLI::Base
Instance Method Details
#handle ⇒ void
This method returns an undefined value.
Handle options.
30 31 32 33 34 35 36 37 |
# File 'lib/seccomp-tools/cli/disasm.rb', line 30 def handle return unless super option[:ifile] = argv.shift return CLI.show(parser.help) if option[:ifile].nil? output { SeccompTools::Disasm.disasm(input, arch: option[:arch]) } end |
#parser ⇒ OptionParser
Define option parser.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/seccomp-tools/cli/disasm.rb', line 17 def parser @parser ||= OptionParser.new do |opt| opt. = usage opt.on('-o', '--output FILE', 'Output result into FILE instead of stdout.') do |o| option[:ofile] = o end option_arch(opt) end end |