geneontology / obographs

Basic and Advanced OBO Graphs: specification and reference implementation
64 stars 12 forks source link

Add a guide for command line tool hackers #8

Open cmungall opened 8 years ago

cmungall commented 8 years ago

One feature of obo is the ease of doing quick command line hacks, e.g.

While not to be encouraged in production pipelines, these are certainly useful for quick ad-hoc operations.

With obographs being json or yaml, it's much easier to write short robust programs that do the equivalent. Nevertheless sometimes it's handy to do a quick ad-hoc series of pipes on the command line. This ticket is for gather ideas on ways to do this. @kltm @dosumis @mcourtot any ideas? Seth, what is your favorite command line json query tool?

kltm commented 8 years ago

httpie (httpie.org) and jq are lovely:

http --verbose GET :6800/m3BatchPrivileged requests=='[{"entity":"meta","operation":"get"}]'
jq --slurp '.[].dependencies | keys | .[]' ./amigo/package.json ./bbop-core/package.json

and very chainable

kltm commented 8 years ago

A more real example:

http -b GET minerva.berkeleybop.org/m3BatchPrivileged requests=='[{"entity":"meta","operation":"get"}]' | jq ".data.meta"