def run
schema = false
format = "table"
parse_options!(options: true) do |parser|
parser.on("--schema", "Describe the queryable schema instead of running a query") { schema = true }
parser.on("--format FORMAT", ["table", "json"], "Output format (table or json)") do |value|
format = value
end
end
query = argv.shift
if schema
warn("warning: ignoring query argument because `--schema` was given") if query
print(Rubydex::Query.schema(format))
return
end
if query.nil? || query.empty?
abort_with_usage("`query` requires a Cypher query argument (or pass `--schema`)")
end
parsed = parse_query(query)
graph = build_graph($stderr)
render(parsed, graph, format)
end