forked from Archives/fx
.gitignore | ||
.travis.yml | ||
bang.js | ||
config.js | ||
Dockerfile | ||
DOCS.md | ||
find.js | ||
fx.js | ||
index.js | ||
LICENSE | ||
package.json | ||
print.js | ||
README.md | ||
reduce.js | ||
stream.js | ||
test.js |
* Function eXecution
Command-line JSON processing tool
Features
- Easy to use
- Standalone binary
- Interactive mode 🎉
- Themes support 🎨
- Streaming support 🌊
- Bash completion
Install
$ npm install -g fx
Or via Homebrew
$ brew install fx
Or download standalone binary from releases page.
Did you like fx? Buy me a beer 🍺 or send come ₿
Usage
Start interactive mode without passing any arguments.
$ curl ... | fx
Or by passing filename as first argument.
$ fx data.json
Pipe into fx
any JSON and anonymous function for reducing it.
$ curl ... | fx 'json => json.message'
Or same as above but short.
$ curl ... | fx this.message
$ curl ... | fx .message
Pass any numbers of arguments as code.
$ curl ... | fx 'json => json.message' 'json => json.filter(x => x.startsWith("a"))'
Access all lodash (or ramda, etc) methods by using .fxrc file.
$ curl ... | fx '_.groupBy("commit.committer.name")' '_.mapValues(_.size)'
Update JSON using spread operator.
$ echo '{"count": 0}' | fx '{...this, count: 1}'
{
"count": 1
}
Pretty print JSON with dot.
$ curl ... | fx .
Stream JSON into fx.
$ kubectl logs ... -f | fx .message
Apply fx to a few JSON files.
$ cat *.json | fx .length
3
4
And try this:
$ fx --life
Documentation
See full documentation.
Links
Related
- gofx – fx-like JSON tool (go)
- eat – converts anything into JSON
- ymlx – fx-like YAML cli processor
- fx-completion – bash completion for fx
- fx-theme-monokai – monokai theme
- fx-theme-night – night theme