From 24a8195702a3e856fbebd34e636230300fec59c6 Mon Sep 17 00:00:00 2001 From: Lifei Zhou Date: Wed, 14 May 2025 18:01:02 +1000 Subject: [PATCH] fix: the conflict_with in no-session arg (#2531) --- crates/goose-cli/src/cli.rs | 3 +-- crates/goose/src/config/base.rs | 1 + crates/goose/src/providers/google.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/goose-cli/src/cli.rs b/crates/goose-cli/src/cli.rs index 32337bff94..261470d743 100644 --- a/crates/goose-cli/src/cli.rs +++ b/crates/goose-cli/src/cli.rs @@ -320,8 +320,7 @@ enum Command { long = "no-session", help = "Run without storing a session file", long_help = "Execute commands without creating or using a session file. Useful for automated runs.", - conflicts_with = "resume", - conflicts_with = "identifier" + conflicts_with_all = ["resume", "name", "path"] )] no_session: bool, diff --git a/crates/goose/src/config/base.rs b/crates/goose/src/config/base.rs index 2863608282..71086656a4 100644 --- a/crates/goose/src/config/base.rs +++ b/crates/goose/src/config/base.rs @@ -346,6 +346,7 @@ impl Config { let mut file = OpenOptions::new() .write(true) .create(true) + .truncate(false) .open(&self.config_path)?; // Acquire an exclusive lock for the entire operation diff --git a/crates/goose/src/providers/google.rs b/crates/goose/src/providers/google.rs index ac35e98d79..8182d3b06e 100644 --- a/crates/goose/src/providers/google.rs +++ b/crates/goose/src/providers/google.rs @@ -184,7 +184,7 @@ impl Provider for GoogleProvider { let mut models: Vec = arr .iter() .filter_map(|m| m.get("name").and_then(|v| v.as_str())) - .map(|name| name.split('/').last().unwrap_or(name).to_string()) + .map(|name| name.split('/').next_back().unwrap_or(name).to_string()) .collect(); models.sort(); Ok(Some(models))