8000 fix(minimald,minimal): rename the in-box min add --session to --box and rewrite the helper's help by minimal-backporter[bot] · Pull Request #4071 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/minimal/src/cmd/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1211,13 +1211,14 @@ pub async fn cmd_add(global: &GlobalArgs, args: AddArgs) -> Result<(), mctx::Err
mctx::AddDepMode::SessionPackages,
)?;
// The host-side add updates `minimal.toml`; unlike the
// in-session helper it does not install into a running session.
// in-box helper it does not install into a running box.
// Qualify the success line so it is not read as a live install.
eprintln!(
"Note: this updated minimal.toml; a running session is \
not modified. The package will be present in sessions \
activated after this change; to add it to an already-running \
session, run `min add --session` from inside that session."
"Note: this updated minimal.toml. It does not change a \
running session box. Session boxes that start after this \
change get the package. To add it to a running box, run \
`min add --box {}` inside that box.",
args.packages.join(" ")
);
}
_ => unreachable!(),
Expand Down
4 changes: 2 additions & 2 deletions crates/minimal/src/loadouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ description = "orientation banner and shaped prompt"
PROMPT_COMMAND = 'eval "$MINIMAL_MOTD"; unset PROMPT_COMMAND MINIMAL_MOTD'
PS1 = 'minimal:\w\$ '
MINIMAL_MOTD = '''
[ -t 1 ] && { printf '\n ████ ████▄\n ▄▄▄ ▀███▄ ▀███▄\n ▀███ ▀███ ▀███\n\n'; printf ' minimal · session %s · loadout %s\n detach: %s' "${MINIMAL_SESSION_NAME:-unnamed}" "${MINIMAL_LOADOUTS:-default (built-in)}" "${MINIMAL_DETACH_HINT:-ctrl-] then d}"; [ -f /workbench/minimal.toml ] || [ -f /workbench/.minimal/minimal.toml ] || printf ' · no minimal.toml here — min init to add one'; printf '\n\n Add tools to this box: min add --session <pkg>\n Search the registry: min search <query>\n\n'; }
[ -t 1 ] && { printf '\n ████ ████▄\n ▄▄▄ ▀███▄ ▀███▄\n ▀███ ▀███ ▀███\n\n'; printf ' minimal · session %s · loadout %s\n detach: %s' "${MINIMAL_SESSION_NAME:-unnamed}" "${MINIMAL_LOADOUTS:-default (built-in)}" "${MINIMAL_DETACH_HINT:-ctrl-] then d}"; [ -f /workbench/minimal.toml ] || [ -f /workbench/.minimal/minimal.toml ] || printf ' · no minimal.toml here — min init to add one'; printf '\n\n Add tools to this box: min add --box <pkg>\n Search the registry: min search <query>\n\n'; }
'''
"#;

Expand Down Expand Up @@ -1446,7 +1446,7 @@ on_activate = { type = "inline", value = "sleep 90", timeout = 90 }
})
.expect("MINIMAL_MOTD present");
assert!(motd.contains("████"), "the mark stays");
assert!(motd.contains("min add --session"), "the pointers stay");
assert!(motd.contains("min add --box"), "the pointers stay");
assert!(motd.contains("${MINIMAL_SESSION_NAME:-"));
assert!(motd.contains("${MINIMAL_LOADOUTS:-"));
// The blueprint clause tests the session workspace itself at
Expand Down
13 changes: 5 additions & 8 deletions crates/minimald/src/attach_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ pub(crate) fn resolve(requested: Option<&str>, rootfs: &Path) -> ShellChoice {
// the same directory's `bash`.
if !rootfs.join(BIN_DIR).join(shell.binary).exists() {
return ShellChoice::bash(Some(format!(
"SHELL names `{requested}`, which is not installed in this session — \
starting bash instead. Add it with: min add --session {}",
"SHELL names `{requested}`, which is not installed in this box. \
Starting bash instead. Add it with: min add --box {}",
shell.package,
)));
}
Expand Down Expand Up @@ -309,22 +309,19 @@ mod tests {
assert_eq!(choice.program, "/usr/bin/bash");
let notice = choice.fallback.expect("an absent shell must be reported");
assert!(notice.contains("/usr/bin/zsh"), "got: {notice}");
assert!(notice.contains("min add --session zsh"), "got: {notice}");
assert!(notice.contains("min add --box zsh"), "got: {notice}");
}

/// The package name is not always the binary name: nushell installs
/// `nu`, so `min add --session nu` would fail. The notice has to
/// `nu`, so `min add --box nu` would fail. The notice has to
/// name the package.
#[test]
fn the_notice_names_the_package_not_the_binary() {
let rootfs = rootfs_with(&[]);
let notice = resolve(Some("nu"), rootfs.path())
.fallback
.expect("an absent shell must be reported");
assert!(
notice.contains("min add --session nushell"),
"got: {notice}"
);
assert!(notice.contains("min add --box nushell"), "got: {notice}");
}

/// Nushell takes no interactive flag — it is interactive when given
Expand Down
Loading
Loading
0