miniximg-shell
Interactive REPL for inspecting and editing Minix v1 filesystem images.
miniximg-shell powers the miniximg shell subcommand in
miniximg-cli. Use this crate
directly only if you want to embed the REPL in another tool; the usual
way to reach it is the CLI.
Why a REPL
For one-off questions, the individual miniximg ls / cat / put commands
are fine. As soon as you start poking around — cd, then ls, then
cat, then maybe edit — the cost of re-opening the image and
re-typing the path on every command adds up. The shell loads the image
once and keeps two working directories (image-side and host-side) so
both feel close at hand.
Path convention
By default, every path refers to the image. Prefix with @ to mean
"this is a host path" instead.
(disk.minix) /> ls /etc # image path
(disk.minix) /> cat @./README.md # host path
(disk.minix) /> put @./fix.sh /usr/local/bin/fix
(disk.minix) /> diff /etc/motd @./old-motd
~ is expanded for host paths (@~/.config/foo). The two cwds are
independent — cd changes the image side, lcd changes the host side.
Command list
| Group | Commands |
|---|---|
| Browse | ls, cd, cat, stat, tree, pwd |
| Mutate (image) | mkdir, rmdir, rm, mv, ln, touch, mknod, chmod, edit |
| Host | lls, lcd, lpwd |
| Cross-fs | put, get, cp, diff |
| Meta | info, fsck, sync, clear, help, exit |
Run help inside the shell for one-liners on each command, or
help <name> for usage details.
Behaviour notes
- Persistence: every mutating command auto-commits to the underlying
image file before returning. There's no separate
savestep. --readonly: opens the image read-only and refuses every mutating command with a clear message. The prompt grows a:rotag so you can't forget.edit: spills the image file into a host temp file, invokes$EDITOR(then$VISUAL, thenvi), and writes the buffer back if the editor exits successfully and the content actually changed.diff: works in any direction — image/image, host/host, or mixed. Lines are diffed via LCS.- History: persisted to
$XDG_DATA_HOME/miniximg/historyby default; pass--history nonefor ephemeral or--history PATHfor a custom location. - Tab completion: bash-style (first TAB extends to longest common
prefix, second TAB lists candidates). Works for commands, image
paths, and
@-prefixed host paths. - Key bindings: rustyline defaults —
Ctrl-A/Ctrl-Ejump to start/end of line,Ctrl-U/Ctrl-Kkill to start/end, ↑/↓ walk the history,Ctrl-Ccancels the current line,Ctrl-Don an empty line exits.
Embedding
use ;
use PathBuf;
run?;
# Ok::
License
MIT. See LICENSE in the workspace root.