You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fx/README.md

107 lines
2.6 KiB
Markdown

5 years ago
<p align="center"><a href="http://fx.wtf"><img src="https://medv.io/assets/fx-logo.png" height="100" alt="fx logo"></a></p>
6 years ago
<p align="center"><img src="https://medv.io/assets/fx.gif" width="562" alt="fx example"></p>
_* Function eXecution_
6 years ago
[![Build Status](https://travis-ci.org/antonmedv/fx.svg?branch=master)](https://travis-ci.org/antonmedv/fx)
6 years ago
[![Npm Version](https://img.shields.io/npm/v/fx.svg)](https://www.npmjs.com/package/fx)
[![Brew Version](https://img.shields.io/homebrew/v/fx.svg)](https://formulae.brew.sh/formula/fx)
6 years ago
Command-line JSON processing tool
## Features
* Easy to use
6 years ago
* Standalone binary
* Interactive mode 🎉
* Streaming support 🌊
6 years ago
## Install
5 years ago
```bash
5 years ago
npm install -g fx
6 years ago
```
6 years ago
Or via Homebrew
5 years ago
```bash
5 years ago
brew install fx
```
Or download standalone binary from [releases](https://github.com/antonmedv/fx/releases)
6 years ago
6 years ago
## Usage
5 years ago
Start [interactive mode](https://github.com/antonmedv/fx/blob/master/DOCS.md#interactive-mode) without passing any arguments.
5 years ago
```bash
$ curl ... | fx
6 years ago
```
6 years ago
Or by passing filename as first argument.
6 years ago
```bash
5 years ago
$ fx data.json
6 years ago
```
5 years ago
Pass a few JSON files.
6 years ago
```bash
5 years ago
cat foo.json bar.json baz.json | fx .message
6 years ago
```
5 years ago
Use full power of JavaScript.
6 years ago
```bash
5 years ago
$ curl ... | fx '.filter(x => x.startsWith("a"))'
6 years ago
```
5 years ago
Access all lodash (or ramda, etc) methods by using [.fxrc](https://github.com/antonmedv/fx/blob/master/DOCS.md#using-fxrc) file.
6 years ago
```bash
6 years ago
$ curl ... | fx '_.groupBy("commit.committer.name")' '_.mapValues(_.size)'
6 years ago
```
6 years ago
Update JSON using spread operator.
```bash
$ echo '{"count": 0}' | fx '{...this, count: 1}'
{
"count": 1
}
6 years ago
```
Extract values from maps.
```bash
$ fx commits.json | fx .[].author.name
```
5 years ago
Print formatted JSON to stdout.
6 years ago
```bash
$ curl ... | fx .
```
5 years ago
Pipe JSON logs stream into fx.
5 years ago
```bash
$ kubectl logs ... -f | fx .message
```
5 years ago
And try this:
```bash
$ fx --life
```
6 years ago
## Documentation
6 years ago
5 years ago
See full [documentation](https://github.com/antonmedv/fx/blob/master/DOCS.md).
6 years ago
6 years ago
## Links
4 years ago
* [Discover how to use fx effectively](http://bit.ly/discover-how-to-use-fx-effectively)
4 years ago
* [Video tutorial](http://bit.ly/youtube-fx-tutorial)
6 years ago
6 years ago
## Related
5 years ago
* [gofx](https://github.com/antonmedv/gofx) fx-like JSON tool (*go*)
5 years ago
* [eat](https://github.com/antonmedv/eat) converts anything into JSON
5 years ago
* [ymlx](https://github.com/matthewadams/ymlx) fx-like YAML cli processor
5 years ago
* [fx-completion](https://github.com/antonmedv/fx-completion) bash completion for fx
* [fx-theme-monokai](https://github.com/antonmedv/fx-theme-monokai) monokai theme
6 years ago
* [fx-theme-night](https://github.com/antonmedv/fx-theme-night) night theme
6 years ago
6 years ago
## License
[MIT](https://github.com/antonmedv/fx/blob/master/LICENSE)