fx/README.md

96 lines
1.5 KiB
Markdown
Raw Normal View History

2022-04-25 20:41:54 +00:00
<p align="center">
<a href="https://asciinema.org/a/F7nHAFp0wbYSXvY29visvNy29">
<img src="docs/images/preview.png" width="759" alt="fx preview">
</a>
</p>
2022-04-16 20:15:18 +00:00
_* Function eXecution_
2022-04-18 21:07:36 +00:00
## Features
2022-04-18 21:11:23 +00:00
- Interactive viewer
2022-04-25 20:41:54 +00:00
- Mouse support
2022-04-18 21:08:04 +00:00
- Preserves key order
- Preserves big numbers
2022-04-18 21:07:36 +00:00
2022-04-16 20:15:18 +00:00
## Install
```bash
2022-04-23 17:50:11 +00:00
brew install fx
2022-04-16 20:15:18 +00:00
```
```bash
2022-04-23 17:50:11 +00:00
snap install fx
```
2022-04-16 20:15:18 +00:00
```bash
scoop install fx
2022-04-16 20:15:18 +00:00
```
2022-04-23 17:50:11 +00:00
```bash
pacman -S fx
```
```bash
go install github.com/antonmedv/fx@latest
```
2022-04-16 20:15:18 +00:00
Or download [pre-built binary](https://github.com/antonmedv/fx/releases).
## Usage
2022-04-17 21:04:58 +00:00
Start the interactive viewer via:
2022-04-16 20:15:18 +00:00
```bash
2022-04-18 21:20:53 +00:00
fx data.json
2022-04-16 20:15:18 +00:00
```
Or
```bash
2022-04-18 21:20:53 +00:00
curl ... | fx
2022-04-16 20:15:18 +00:00
```
2022-04-17 21:04:58 +00:00
Type `?` to see full list of key shortcuts.
2022-04-18 21:20:53 +00:00
Pretty print:
```bash
curl ... | fx .
```
2022-04-16 20:15:18 +00:00
### Reducers
2022-04-18 21:11:23 +00:00
Write reducers in your favorite language: [JavaScript](docs/reducers.md#node) (default),
2022-04-18 21:02:55 +00:00
[Python](docs/reducers.md#python), or [Ruby](docs/reducers.md#ruby).
2022-04-16 20:15:18 +00:00
```bash
2022-04-18 21:11:23 +00:00
export FX_LANG=node
2022-04-18 21:04:23 +00:00
fx data.json '.filter(x => x.startsWith("a"))'
2022-04-16 20:15:18 +00:00
```
2022-04-18 21:02:55 +00:00
```bash
2022-04-18 21:04:23 +00:00
export FX_LANG=python
fx data.json '[x["age"] + i for i in range(10)]'
2022-04-18 21:02:55 +00:00
```
2022-04-16 20:15:18 +00:00
```bash
2022-04-18 21:04:23 +00:00
export FX_LANG=ruby
fx data.json 'x.to_a.map {|x| x[1]}'
2022-04-16 20:15:18 +00:00
```
2022-04-17 21:04:58 +00:00
## Documentation
2022-04-16 20:15:18 +00:00
2022-04-17 21:04:58 +00:00
See full [documentation](https://github.com/antonmedv/fx/blob/master/DOCS.md).
2022-04-16 20:15:18 +00:00
2022-04-17 21:04:58 +00:00
## Themes
2022-04-16 20:15:18 +00:00
2022-04-18 21:02:55 +00:00
Theme can be configured by setting environment variable `FX_THEME` from `1`
to `9`:
2022-04-16 20:15:18 +00:00
```bash
2022-04-17 21:04:58 +00:00
export FX_THEME=9
2022-04-16 20:15:18 +00:00
```
2022-04-17 21:04:58 +00:00
<img width="1214" alt="themes" src="docs/images/themes.png">
2022-04-16 20:15:18 +00:00
## License
[MIT](https://github.com/antonmedv/fx/blob/master/LICENSE)