Module: Bpfql::Cli
- Defined in:
- lib/bpfql/cli.rb
Constant Summary collapse
- USAGE =
<<~USAGE #{File.basename $0} version #{Bpfql::VERSION} usage: \t#{File.basename $0} <YAML_FILE> USAGE
Class Method Summary collapse
Class Method Details
.run(argv) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bpfql/cli.rb', line 11 def self.run(argv) if argv.size != 1 $stderr.puts USAGE exit 1 end file = argv[0] q = nil case File.extname(file) when ".rb", ".bpfql" dsl = File.read(file) q = [eval(dsl)] when ".yml", ".yaml" q = Bpfql::Query.parse_yaml(File.read file) end r = Bpfql::Runner.new(q[0]) r.run end |