Awesome
OTree - Object Tree TUI Viewer
A command line tool to view objects (JSON/YAML/TOML) in TUI tree widget.
Install
Download binary files from release page.
You can also build it from source (require cargo
installed):
cargo install --git https://github.com/fioncat/otree
Arch Linux (AUR)
You can install otree
from the AUR with using an AUR helper.
paru -S otree
macOS and Linux (Homebrew)
You can install otree
using Homebrew.
brew install otree
Usage
Open a JSON/YAML/TOML file in TUI tree viewer:
otree /path/to/file.json
otree /path/to/file.yaml
otree /path/to/file.toml
For more command usage, please run otree --help
.
You can configure TUI keys, colors, and more in ~/.config/otree.toml
, the default configuration is here.
For all available actions and their default key bindings, please refer to: All Available Actions.
For how to configure TUI colors, please refer to: Colors Document.
Features
- UI: Header (v0.1)
- UI: Tree Overview (v0.1)
- UI: Data Block (v0.1)
- UI: Footer to show current root and identify (and other messages) (v0.2)
- UI: Filter Input
- UI: Popup widget to show error or help messages (v0.2)
- Action: Change current selected item as root (v0.1)
- Action: Back to previous root (v0.1)
- Action: Scale up/down tree widget (v0.1)
- Action: Mouse click actions
- Action: Mouse scroll actions
- Action: Mouse select actions
- Action: Open current selected item in editor ReadOnly (v0.2)
- Action: Switch between tree overview and data block (v0.1)
- Action: Jump to parent item (v0.1)
- Action: Jump to parent item and close (v0.1)
- Action: Expand selected item's children
- Action: Expand all items
- Action: Close all opened items (v0.1)
- Action: Filter items, highlight searching keywords
- Action: Popup to show help messages
- Action: Clipboard support, copy current item's content (might need to call external program like
wl-copy
,pbcopy
) (v0.2) - Syntax highlighting in data block (v0.2)
- Allow user to customize TUI colors and key bindings (and other things you can imagine) (v0.1)
- Filter items! (Like jnv)
- When
OTREE_DEBUG
set totrue
, write some debug logs to a file
If you have any great ideas, please create an issue, thanks!
Thanks
I created this tool to better view those super deep YAML files of Kubernetes while jnv only supports JSON.
This is based on the amazing TUI framework ratatui and its tree widget tui-tree-widget.