Last active
August 29, 2015 14:26
-
-
Save ayosec/35867a22e1f2986546aa to your computer and use it in GitHub Desktop.
Launch Cypher queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
case ARGV.size | |
when 1 | |
host = ARGV[0] | |
body = STDIN.read | |
when 2 | |
host = ARGV[0] | |
body = ARGV[1] | |
else | |
puts "Usage #$0 host [cypher]" | |
exit 1 | |
end | |
require "json" | |
body = { query: body }.to_json | |
exec "curl", "-w", "\n", "-s", "#{host}/db/data/cypher", "-H", "Content-Type: application/json", "-d", body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment