Skip to content

Commit dab63e6

Browse files
committed
fix(cli): show valid approval policy values in --ask-for-approval help
Fixes bounty issue #1424 The --ask-for-approval flag now displays valid options (untrusted, on-failure, on-request, never) in the help text using clap's value_parser attribute. Invalid values are also rejected with a clear error message. Also fixes formatting issues in the file.
1 parent 771ba8f commit dab63e6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

cortex-cli/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct InteractiveArgs {
7878
sandbox_mode: Option<String>,
7979

8080
/// Configure when the model requires human approval
81-
#[arg(long = "ask-for-approval", short = 'a')]
81+
#[arg(long = "ask-for-approval", short = 'a', value_parser = ["untrusted", "on-failure", "on-request", "never"])]
8282
approval_policy: Option<String>,
8383

8484
/// Convenience alias for low-friction sandboxed automatic execution
@@ -860,13 +860,13 @@ async fn run_serve(serve_cli: ServeCommand) -> Result<()> {
860860
let result = cortex_app_server::run(config).await;
861861

862862
// Stop mDNS advertising on shutdown
863-
if let Some(ref mut mdns) = mdns_service {
864-
if let Err(e) = mdns.stop_advertising().await {
865-
eprintln!("Warning: Failed to stop mDNS advertising: {e}");
866-
}
863+
if let Some(ref mut mdns) = mdns_service
864+
&& let Err(e) = mdns.stop_advertising().await
865+
{
866+
eprintln!("Warning: Failed to stop mDNS advertising: {e}");
867867
}
868868

869-
result.map_err(Into::into)
869+
result
870870
}
871871

872872
async fn run_servers(servers_cli: ServersCommand) -> Result<()> {

0 commit comments

Comments
 (0)