1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Interactive shell for [Minix v1 filesystem images][minix].
//!
//! `miniximg shell foo.img` drops into a REPL where paths default to the
//! image. Anything prefixed with `@` is interpreted as a host path
//! instead. Two working directories are tracked independently — `cd`
//! changes the image-side cwd, `lcd` changes the host-side one — so the
//! user can move around both filesystems in parallel.
//!
//! ```no_run
//! use miniximg_shell::{run, ShellOptions};
//! use std::path::PathBuf;
//!
//! run(ShellOptions {
//! image: PathBuf::from("disk.img"),
//! readonly: false,
//! history: None,
//! })?;
//! # Ok::<(), anyhow::Error>(())
//! ```
//!
//! Modifications are auto-committed to the image file as each command
//! returns. Pass `readonly: true` to refuse every mutating command.
//!
//! [minix]: https://en.wikipedia.org/wiki/MINIX_file_system
pub use ShellOptions;
use Result;
/// Run the interactive shell against the configured image, returning
/// when the user issues `exit`, `quit`, or `Ctrl-D` on an empty line.