make strace parser use slop for command line options

This commit is contained in:
Brendan McDevitt 2020-08-06 18:36:02 -05:00
parent 4613590dec
commit 59b4028042
2 changed files with 24 additions and 6 deletions

View file

@ -29,9 +29,3 @@ class StraceParser
def write_sys_calls
end
end
# to test - why is my dbb-app segfaulting on my manjaro linux install?
# something to do with qt5 but lets see if we can write a better tool to help
filepath = './strace.out'
parser = StraceParser.new(filepath)
binding.pry

24
strace_parser/stracer.rb Executable file
View file

@ -0,0 +1,24 @@
require './strace_parser.rb'
require 'slop'
opts = Slop.parse do |o|
o.string '-f', '--file', 'a filename to read'
o.bool '-c', '--count', 'enable count of systemcall output'
#puts Slop::VERSION
#exit
end
ARGV #=> --filename /path/to/strace_file.out
hash = opts.to_hash #=> { host: "192.168.0.1", login: "alice", port: 80, verbose: true, quiet: false, check_ssl_certificate: true }
file = hash[:file]
count = hash[:count]
parser = StraceParser.new(file)
#binding.pry
if count
puts parser.sys_call_counts
end