Skip to content
/ oafp Public

Command-line tool that takes an input, usually a data structure (e.g. json), and transforms it to an equivalent data structure in another format or visualization. The output data can be filtered and transformed.

License

Notifications You must be signed in to change notification settings

OpenAF/oafp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAF processor

Takes an input, usually a data structure such as json, and transforms it to an equivalent data structure in another format or visualization. The output data can be filtered through JMESPath, SQL or OpenAF's nLinq and provided transformers can also be applied to it.

Installing

opack install oafproc

After install you can check more by executing:

oafp -h
oafp help=filters
oafp help=template

The 'oafp' command is usually installed in the OpenAF main folder.

Building

On the source folder (/src) using build.yaml oJob:

Op Description
build Builds 'src/oafp.source.js' and compiles it into 'src/oafp.js'
pack Builds, tests and creates the 'pack/' folder ready for packing into an oPack
clean Cleans all created artifacts and folders
test Builds and tests
dev Builds a 'src/oafp.source.js' that will dynamically load 'src/include/*' for dev proposes

Examples

# simple processing through pipe
cat someJsonFile.json | oafp

# simple processing through pipe with scrolling
cat someJsonFile.json | oafp output=ctree | less -r

# specifying the input type and output format
cat data.ndjson | oafp input=ndjson output=cslon
# markdown parsing of a file
oafp file=someFile.md input=md

# table with the latest news from Google
curl -L https://blog.google/rss | oafp path="rss.channel.item" sql="select title, pubDate" output=ctable

# table with the number of people in space per space craft
curl http://api.open-notify.org/astros.json | oafp path="people" sql="select \"craft\", count(1) \"people\" group by \"craft\"" output=ctable

# markdown table with the current closest asteroids to earth
curl "https://api.nasa.gov/neo/rest/v1/feed?API_KEY=DEMO_KEY" | oafp path="near_earth_objects" maptoarray=true output=json | oafp path="[0][].{name:name,magnitude:absolute_magnitude_h,hazardous:is_potentially_hazardous_asteroid,distance:close_approach_data[0].miss_distance.kilometers}" sql="select * order by distance" output=mdtable

See more

Check the main usage documentation.

Additional documentation:

About

Command-line tool that takes an input, usually a data structure (e.g. json), and transforms it to an equivalent data structure in another format or visualization. The output data can be filtered and transformed.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published