https://github.com/amtoine/nu_plugin_explore
A fast structured data explorer for Nushell.
https://github.com/amtoine/nu_plugin_explore
explorer nushell plugin structured-data
Last synced: 3 months ago
JSON representation
A fast structured data explorer for Nushell.
- Host: GitHub
- URL: https://github.com/amtoine/nu_plugin_explore
- Owner: amtoine
- License: gpl-3.0
- Created: 2023-08-15T08:58:17.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T17:09:51.000Z (about 1 year ago)
- Last Synced: 2024-04-14T12:37:51.769Z (about 1 year ago)
- Topics: explorer, nushell, plugin, structured-data
- Language: Rust
- Homepage:
- Size: 1.36 MB
- Stars: 7
- Watchers: 1
- Forks: 6
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nu_plugin_explore
A fast *interactive explorer* tool for *structured data* inspired by [`nu-explore`]# table of content
- [*introduction*](#introduction)
- [*the idea behind an explorer*](#the-idea-behind-an-explorer)
- [*why not `nu-explore`?*](#why-not-nu-explore)
- [*installation*](#installation)
- [*using `nupm install` (recommended)*](#using-nupm-install-recommended)
- [*building from source*](#building-from-source)
- [*usage*](#usage)
- [*demo*](#demo)
- [*configuration*](#configuration)
- [*default configuration*](#default-configuration)
- [*an example*](#an-example)
- [*some convenience*](#-some-convenience)
- [*see the documentation locally*](#see-the-documentation-locally)
- [*troubleshooting*](#troubleshooting)
- [*contributing*](#contributing)
- [*TODO*](#todo)
- [*features*](#features)
- [*internal*](#internal)# introduction
## the idea behind an *explorer*
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 configurablewill come very handy in a day-to-day basis for me at least :)
## why not `nu-explore`?
- 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 Rustso here we are... LET'S GO :muscle:
# installation
> **Important**
> if you are using bleeding-edge versions of Nushell, please make sure the
> Nushell dependencies are the same as your Nushell install by running
> ```nushell
> use scripts/deps.nu; deps --current
> ```## using `nupm install` (recommended)
- download [nushell/nupm](https://github.com/nushell/nupm)
- load the `nupm` module
```nushell
use /path/to/nupm/
```
- run the install process
```nushell
nupm install --path .
```
## building from source
- build the plugin
```shell
make build
```
- register the plugin in [Nushell]
```nushell
make register
```
- do not forget to restart [Nushell]> **Note**
> alternatively, you can use directly `make install`# usage
- get some help
```nushell
help nu_plugin_explore
```
- run the command
```nushell
open Cargo.toml | nu_plugin_explore
```## demo
# configuration
## default configuration
you can find it in [`default.nuon`](./examples/config/default.nuon).you can copy-paste it in your `config.nu` and set `$env.config.plugins.explore` to it:
```nushell
$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`
```nushell
$env.config.plugins.explore = (open ($nu.default-config-dir | path join "nu_plugin_explore.nu"))
```## an example
if you do not like the Vim bindings by default you can replace the navigation part with
```nushell
$env.config.plugins.explore.keybindings.navigation = {
left: 'left',
down: 'down',
up: 'up',
right: 'right',
}
```
and voila :yum:# see the documentation locally
```nushell
cargo doc --document-private-items --no-deps --open
```# troubleshooting
in case you get some weird error or behaviour, before filing any issue, the
easiest is to make sure the plugin is compiled with the same revision as the
Nushell you are using!
```nushell
use scripts/deps.nu; deps --current
```
and then you can come back to the [*installation*](#installation) section.> **Note**
> of course, this will not work if the version of Nushell you are using is too
> old, because then the state of `nu_plugin_explore` will be too recent for
> everything to compile properly...# contributing
in order to help, you can have a look at
- the [todo](#todo) list down below, there might be unticked tasks to tackle
- the issues and bugs in the [issue tracker](https://github.com/amtoine/nu_plugin_explore/issues)
- the `FIXME` and `TODO` comments in the source base# TODO
## features
- [x] support non-character bindings
- [ ] when going into a file or URL, open it
- [x] give different colors to names and type
- [x] show true tables as such
- [x] get the config from `$env.config` => can parse configuration from CLI
- [x] add check for the config to make sure it's valid
- [x] support for editing cells in INSERT mode
- [x] string cells
- [x] other simple cells
- [x] all the cells
- [x] detect if a string is of a particular type, path, URL, ...## internal
- [x] add tests...
- [x] to `navigation.rs` to make sure the navigation in the data is ok
- [x] to `app.rs` to make sure the application state machine works
- [x] to `parsing.rs` to make sure the parsing of the config works
- [x] to `tui.rs` to make sure the rendering works as intended
- [ ] get rid of the `.clone`s
- [ ] handle errors properly (`.unwrap`s and `panic!`s)
- [ ] restrict the visibility of objects when possible
- [ ] write better error messages when some test fails[Nushell]: https://nushell.sh
[nushell/nushell]: https://github.com/nushell/nushell
[`nu-explore`]: https://crates.io/crates/nu-explore[`nu-plugin`]: https://crates.io/crates/nu-plugin
[`nu-protocol`]: https://crates.io/crates/nu-protocol
[crates.io]: https://crates.io