A fast interactive explorer tool for structured data inspired by nu-explore
i think having an interactive explorer for structured data is a requirement for a shell like
Nushell!
the ability to
- traverse the data with a few quick key bindings
- peek the data at any level
- edit the data on the fly (COMING SOON)
- all while being configurable
will come very handy in a day-to-day basis for me at least :)
- it's a bit too complex for what it does to me
- the bindings are not configurable
- the code was really hard to wrap my head around
- i wanted to have fun learning about Nushell plugins and TUI applications in Rust
so here we are... LET'S GO 💪
Note
this is the development version ofnu_plugin_explore, thus it does not require Nushell to be installed with a stable version.
let's setup the Nushell dependencies locally, because nu-plugin and nu-protocol are not release
in version 0.xx.1, only the stable 0.xx.0 😮
- clone the Nushell repository somewhere
- setup the dependencies
make dev-depsthere are three ways to do it:
- build the plugin
make build- register the plugin in Nushell
make register- do not forget to restart Nushell
Note
alternatively, you can use directlymake install
- define the install root, e.g.
$env.CARGO_HOMEor/some/where/plugins/
let install_root: path = ...- build and install the plugin
cargo install --path . --root $install_root- register the plugin in Nushell
nu --commands $"register ($install_root | path join "bin" $name)"- do not forget to restart Nushell
Warning
this is a very alpha software
- download nushell/nupm
- load the
nupmmodule
use /path/to/nupm/- run the install process
nupm install --path .- get some help
help nu_plugin_explore- run the command
open Cargo.toml | nu_plugin_exploreyou can find it in default.nuon.
you can copy-paste it in your config.nu and set $env.explore_config to it:
$env.config.plugins.explore = {
# content of the default config
}alternately, you can copy-paste the default config file to $nu.default-config-dir and add the following line to your config.nu
$env.config.plugins.explore = (open ($nu.default-config-dir | path join "nu_plugin_explore.nu"))if you do not like the Vim bindings by default you can replace the navigation part with
$env.config.plugins.explore.keybindings.navigation = {
left: 'left',
down: 'down',
up: 'up',
right: 'right',
}and voila 😋
cargo doc --document-private-items --no-deps --openin order to help, you can have a look at
- the todo list down below, there might be unticked tasks to tackle
- the issues and bugs in the issue tracker
- the
FIXMEandTODOcomments in the source base
- support non-character bindings
- when going into a file or URL, open it
- give different colors to names and type
- show true tables as such
- get the config from
$env.config=> can parse configuration from CLI - add check for the config to make sure it's valid
- support for editing cells in INSERT mode
- string cells
- other simple cells
- detect if a string is of a particular type, path, URL, ...
- add tests...
- to
navigation.rsto make sure the navigation in the data is ok - to
app.rsto make sure the application state machine works - to
parsing.rsto make sure the parsing of the config works - to
tui.rsto make sure the rendering works as intended
- to
- get rid of the
.clones - handle errors properly (
.unwraps andpanic!s) - restrict the visibility of objects when possible
- write better error messages when some test fails
