|
1 | 1 | # ro-crate-tui |
2 | | -A TUI for ro-crate navigation |
| 2 | + |
| 3 | +A terminal user interface (TUI) for exploring RO-Crate archives interactively. |
| 4 | + |
| 5 | +ro-crate-tui lets you open RO-Crate packages (local or remote) and navigate their entities, subcrates, and metadata with simple commands from a compact TUI — useful for inspecting RO-Crates without leaving the terminal. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Load RO-Crates from: |
| 10 | + - local folders containing `ro-crate-metadata.json` |
| 11 | + - `.zip` archives containing `ro-crate-metadata.json` |
| 12 | + - direct URLs to RO-Crate archives |
| 13 | + - DOIs resolving to Zenodo or similar repositories |
| 14 | +- Browse and pretty-print crate metadata |
| 15 | +- List subcrates, properties, and ids used in a crate |
| 16 | +- Enter subcrates or folders and inspect nested crates |
| 17 | +- Search across indexed crates (uses a crate index) |
| 18 | +- Simple command palette with completion for ids and subcrates |
| 19 | +- Lightweight, fast, and keyboard-driven |
| 20 | + |
| 21 | +## Built with |
| 22 | + |
| 23 | +- Rust |
| 24 | +- ratatui (terminal UI) |
| 25 | +- rocraters / ro-crate libraries for RO-Crate parsing |
| 26 | +- rocrate_indexer for indexing & search |
| 27 | + |
| 28 | +## Quickstart |
| 29 | + |
| 30 | +Prerequisites: |
| 31 | +- Rust toolchain (stable) |
| 32 | +- cargo |
| 33 | + |
| 34 | +Clone and build: |
| 35 | + |
| 36 | +```bash |
| 37 | +git clone https://github.com/arunaengine/ro-crate-tui.git |
| 38 | +cd ro-crate-tui |
| 39 | +cargo build --release |
| 40 | +``` |
| 41 | + |
| 42 | +Or install locally with cargo: |
| 43 | + |
| 44 | +```bash |
| 45 | +cargo install --path . |
| 46 | +``` |
| 47 | + |
| 48 | +Run the TUI: |
| 49 | + |
| 50 | +```bash |
| 51 | +cargo run --release |
| 52 | +``` |
| 53 | + |
| 54 | +(or run the installed binary `ro-crate-tui` if you used `cargo install`) |
| 55 | + |
| 56 | +## Commands |
| 57 | + |
| 58 | +While in the TUI, enter commands at the prompt. The primary commands are: |
| 59 | + |
| 60 | +- load <url|path> |
| 61 | + Load an RO-Crate from a local path, a `.zip` archive, a direct URL, or a DOI that resolves to a crate archive. |
| 62 | + |
| 63 | +- ls |
| 64 | + Show the full RO-Crate (pretty-printed JSON). |
| 65 | + |
| 66 | +- ls sub |
| 67 | + List all subcrates in the current crate. |
| 68 | + |
| 69 | +- ls ids |
| 70 | + List all ids used in the current RO-Crate. |
| 71 | + |
| 72 | +- ls props |
| 73 | + List all properties used in the current RO-Crate. |
| 74 | + |
| 75 | +- get <@id> |
| 76 | + Pretty-print JSON for the entity identified by `@id`. |
| 77 | + |
| 78 | +- cd <id> |
| 79 | + Enter a subcrate or folder. |
| 80 | + |
| 81 | +- cd .. |
| 82 | + Return to the parent crate. |
| 83 | + |
| 84 | +- cd / |
| 85 | + Return to the root crate in the session. |
| 86 | + |
| 87 | +- pwd |
| 88 | + Print the current path (crate stack location). |
| 89 | + |
| 90 | +- search <query> |
| 91 | + Search the indexed crates for matching entities (uses the local crate index). |
| 92 | + |
| 93 | +- help |
| 94 | + Show the help message with available commands. |
| 95 | + |
| 96 | +If you enter an unknown command the help message is shown with usage hints. |
| 97 | + |
| 98 | +## Examples |
| 99 | + |
| 100 | +Load a local crate (folder with `ro-crate-metadata.json`): |
| 101 | + |
| 102 | +``` |
| 103 | +load /path/to/my-ro-crate/ |
| 104 | +``` |
| 105 | + |
| 106 | +Load a crate archive or remote crate: |
| 107 | + |
| 108 | +``` |
| 109 | +load https://example.org/archives/my-ro-crate.zip |
| 110 | +load https://zenodo.org/record/XXXXX (DOI URL resolving to an RO-Crate) |
| 111 | +``` |
| 112 | + |
| 113 | +List subcrates: |
| 114 | + |
| 115 | +``` |
| 116 | +ls sub |
| 117 | +``` |
| 118 | + |
| 119 | +Inspect a specific entity by id: |
| 120 | + |
| 121 | +``` |
| 122 | +get @dataset1 |
| 123 | +``` |
| 124 | + |
| 125 | +Change context into a subcrate: |
| 126 | + |
| 127 | +``` |
| 128 | +cd my-subcrate-id |
| 129 | +pwd |
| 130 | +``` |
| 131 | + |
| 132 | +Search the index for an entity or term: |
| 133 | + |
| 134 | +``` |
| 135 | +search genome |
| 136 | +``` |
| 137 | + |
| 138 | +## Indexing & Search |
| 139 | + |
| 140 | +ro-crate-tui ships with an embedded crate index (via `rocrate_indexer`) that is used for fast lookups and search. When you import a crate with `load`, the crate is added to the local index to enable subsequent `search` queries and faster lookups across previously loaded crates. |
| 141 | + |
| 142 | +The index is stored using the library's default location/mechanism (see crate index docs for details). |
| 143 | + |
| 144 | +## Development |
| 145 | + |
| 146 | +- Format and check: |
| 147 | + |
| 148 | +```bash |
| 149 | +cargo fmt |
| 150 | +cargo clippy |
| 151 | +``` |
| 152 | + |
| 153 | +- Run the app during development: |
| 154 | + |
| 155 | +```bash |
| 156 | +cargo run |
| 157 | +``` |
| 158 | + |
| 159 | +- Run tests (if any): |
| 160 | + |
| 161 | +```bash |
| 162 | +cargo test |
| 163 | +``` |
| 164 | + |
| 165 | +Contributions are welcome — please open issues and pull requests on the repository. |
| 166 | + |
| 167 | +## Troubleshooting |
| 168 | + |
| 169 | +- If the terminal gets into a corrupted state due to a crash, running `reset` or closing and reopening the terminal usually restores it. The app attempts to restore terminal state on normal exit. |
| 170 | +- If `load` fails for a remote URL, ensure the URL is reachable and points to a valid RO-Crate archive or `ro-crate-metadata.json`. |
| 171 | +- For encoding or JSON errors, verify the crate's `ro-crate-metadata.json` is valid JSON and conforms to the RO-Crate specification. |
| 172 | + |
| 173 | +## License |
| 174 | + |
| 175 | +See the repository's `LICENSE` file for license information. |
| 176 | + |
| 177 | +## Acknowledgements |
| 178 | + |
| 179 | +- This project builds on the `rocraters` and `rocrate_indexer` crates for RO-Crate handling and indexing. |
| 180 | +- Terminal UI based on `ratatui`. |
0 commit comments