Restore profile-first interactive launches
This commit is contained in:
parent
b9c3bcfbbc
commit
b9dbd78087
1 changed files with 67 additions and 15 deletions
|
|
@ -233,11 +233,31 @@ fn unsupported_host_and_configuration_errors_keep_their_cause() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn command_line_requires_an_explicit_profile_and_preserves_command_bytes() {
|
||||
fn command_line_accepts_profile_entry_and_preserves_explicit_command_bytes() {
|
||||
let parsed =
|
||||
lazaret_client::cli::parse(["agent"].map(OsString::from), PathBuf::from("/current"))
|
||||
.unwrap();
|
||||
let lazaret_client::cli::Command::Run(parsed) = parsed else {
|
||||
panic!("expected run command");
|
||||
};
|
||||
assert_eq!(parsed.profile, "agent");
|
||||
assert_eq!(parsed.workspace, PathBuf::from("/current"));
|
||||
assert_eq!(parsed.configuration, None);
|
||||
assert_eq!(parsed.argv, [b"/bin/bash".to_vec()]);
|
||||
|
||||
let parsed = lazaret_client::cli::parse(
|
||||
["run", "--profile", "state"].map(OsString::from),
|
||||
PathBuf::from("/current"),
|
||||
)
|
||||
.unwrap();
|
||||
let lazaret_client::cli::Command::Run(parsed) = parsed else {
|
||||
panic!("expected run command");
|
||||
};
|
||||
assert_eq!(parsed.profile, "state");
|
||||
assert_eq!(parsed.argv, [b"/bin/bash".to_vec()]);
|
||||
|
||||
let parsed = lazaret_client::cli::parse(
|
||||
[
|
||||
"run",
|
||||
"--profile",
|
||||
"agent",
|
||||
"--workspace",
|
||||
"/project",
|
||||
|
|
@ -305,6 +325,8 @@ fn public_help_explains_commands_and_options() {
|
|||
&["--help"][..],
|
||||
&[
|
||||
"Run development tools in an isolated gVisor sandbox",
|
||||
"Usage: lazaret <PROFILE>",
|
||||
"lazaret PROFILE",
|
||||
"run",
|
||||
"state",
|
||||
][..],
|
||||
|
|
@ -314,7 +336,7 @@ fn public_help_explains_commands_and_options() {
|
|||
&[
|
||||
"Agent profile to use",
|
||||
"Project directory to share",
|
||||
"Command and arguments to run",
|
||||
"default `/bin/bash`",
|
||||
],
|
||||
),
|
||||
(
|
||||
|
|
@ -347,11 +369,10 @@ fn public_help_explains_commands_and_options() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn clap_rejects_missing_profile_command_and_ambiguous_reset_scope() {
|
||||
fn clap_rejects_missing_profile_and_ambiguous_reset_scope() {
|
||||
let workspace = PathBuf::from("/current");
|
||||
for arguments in [
|
||||
vec!["run", "--", "tool"],
|
||||
vec!["run", "--profile", "agent"],
|
||||
vec!["state", "reset", "--profile", "agent"],
|
||||
vec![
|
||||
"state",
|
||||
|
|
|
|||
Loading…
Reference in a new issue