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/doc/doc.md

67 lines
2.0 KiB
Markdown

2 years ago
# Documentation
2 years ago
The **fx** can work in two modes: as a reducer or an interactive viewer.
To start the interactive mode pipe a JSON into **fx**:
2 years ago
```sh
$ curl ... | fx
```
Or you can pass a filename as the first parameter:
```sh
$ fx data.json
```
## Reducers
Use [JavaScript](js.md), [Python](python.md), or [Ruby](ruby.md).
2 years ago
## Streaming mode
The **fx** supports line-delimited JSON streaming or concatenated JSON streaming.
2 years ago
```sh
$ echo '
> {"message": "hello"}
> {"message": "world!"}
> ' | fx .message
hello
world!
2 years ago
```
## Interactive mode
Type `?` to see the full list of available shortcuts while in the interactive mode.
2 years ago
### Search
Press `/` and type regexp pattern to search in the current JSON.
Search is performed on the internal representation of the JSON without newlines.
2 years ago
Type `n` to jump to the next result, and `N` to the previous
2 years ago
### Selecting text
You can't just select text in fx. This is due to the fact that all mouse events are
redirected to stdin. To be able to select again you need to instruct your terminal
2 years ago
not to do it. This can be done by holding special keys while selecting:
| Key | Terminal |
|------------------|---------------|
| `Option`+`Mouse` | iTerm2, Hyper |
| `Fn`+`Mouse` | Terminal.app |
| `Shift`+`Mouse` | Linux |
## Configs
2 years ago
Next configs available for **fx** via environment variables.
2 years ago
| Name | Values | Description |
|----------------|-----------------------------------------------------|-------------------------------------------------------|
2 years ago
| `FX_LANG` | `js` (default), `node`, `python`, `python3`, `ruby` | Reducer type. |
2 years ago
| `FX_THEME` | `0` (disable colors), `1` (default), `2..9` | Color theme. |
| `FX_SHOW_SIZE` | `true` or `false` (default) | Show size of arrays and object in collapsed previews. |