mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 14:44:21 +01:00
feat(cli): Add --quiet /-q flag to goose run (#2939)
This commit is contained in:
committed by
GitHub
parent
98ac09cda0
commit
4e97ffacd6
@@ -491,6 +491,14 @@ enum Command {
|
|||||||
value_delimiter = ','
|
value_delimiter = ','
|
||||||
)]
|
)]
|
||||||
builtins: Vec<String>,
|
builtins: Vec<String>,
|
||||||
|
|
||||||
|
/// Quiet mode - suppress non-response output
|
||||||
|
#[arg(
|
||||||
|
short = 'q',
|
||||||
|
long = "quiet",
|
||||||
|
help = "Quiet mode. Suppress non-response output, printing only the model response to stdout"
|
||||||
|
)]
|
||||||
|
quiet: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Recipe utilities for validation and deeplinking
|
/// Recipe utilities for validation and deeplinking
|
||||||
@@ -644,7 +652,8 @@ pub async fn cli() -> Result<()> {
|
|||||||
settings: None,
|
settings: None,
|
||||||
debug,
|
debug,
|
||||||
max_tool_repetitions,
|
max_tool_repetitions,
|
||||||
interactive: true, // Session command is always interactive
|
interactive: true,
|
||||||
|
quiet: false,
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
setup_logging(
|
setup_logging(
|
||||||
@@ -688,6 +697,7 @@ pub async fn cli() -> Result<()> {
|
|||||||
builtins,
|
builtins,
|
||||||
params,
|
params,
|
||||||
explain,
|
explain,
|
||||||
|
quiet,
|
||||||
}) => {
|
}) => {
|
||||||
let (input_config, session_settings) = match (instructions, input_text, recipe, explain)
|
let (input_config, session_settings) = match (instructions, input_text, recipe, explain)
|
||||||
{
|
{
|
||||||
@@ -773,6 +783,7 @@ pub async fn cli() -> Result<()> {
|
|||||||
debug,
|
debug,
|
||||||
max_tool_repetitions,
|
max_tool_repetitions,
|
||||||
interactive, // Use the interactive flag from the Run command
|
interactive, // Use the interactive flag from the Run command
|
||||||
|
quiet,
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@@ -889,6 +900,7 @@ pub async fn cli() -> Result<()> {
|
|||||||
debug: false,
|
debug: false,
|
||||||
max_tool_repetitions: None,
|
max_tool_repetitions: None,
|
||||||
interactive: true, // Default case is always interactive
|
interactive: true, // Default case is always interactive
|
||||||
|
quiet: false,
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
setup_logging(
|
setup_logging(
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ pub async fn agent_generator(
|
|||||||
debug: false,
|
debug: false,
|
||||||
max_tool_repetitions: None,
|
max_tool_repetitions: None,
|
||||||
interactive: false, // Benchmarking is non-interactive
|
interactive: false, // Benchmarking is non-interactive
|
||||||
|
quiet: false,
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ pub struct SessionBuilderConfig {
|
|||||||
pub max_tool_repetitions: Option<u32>,
|
pub max_tool_repetitions: Option<u32>,
|
||||||
/// Whether this session will be used interactively (affects debugging prompts)
|
/// Whether this session will be used interactively (affects debugging prompts)
|
||||||
pub interactive: bool,
|
pub interactive: bool,
|
||||||
|
/// Quiet mode - suppress non-response output
|
||||||
|
pub quiet: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Offers to help debug an extension failure by creating a minimal debugging session
|
/// Offers to help debug an extension failure by creating a minimal debugging session
|
||||||
@@ -457,13 +459,16 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> Session {
|
|||||||
session.agent.override_system_prompt(override_prompt).await;
|
session.agent.override_system_prompt(override_prompt).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
output::display_session_info(
|
// Display session information unless in quiet mode
|
||||||
session_config.resume,
|
if !session_config.quiet {
|
||||||
&provider_name,
|
output::display_session_info(
|
||||||
&model_name,
|
session_config.resume,
|
||||||
&session_file,
|
&provider_name,
|
||||||
Some(&provider_for_display),
|
&model_name,
|
||||||
);
|
&session_file,
|
||||||
|
Some(&provider_for_display),
|
||||||
|
);
|
||||||
|
}
|
||||||
session
|
session
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,6 +491,7 @@ mod tests {
|
|||||||
debug: true,
|
debug: true,
|
||||||
max_tool_repetitions: Some(5),
|
max_tool_repetitions: Some(5),
|
||||||
interactive: true,
|
interactive: true,
|
||||||
|
quiet: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(config.extensions.len(), 1);
|
assert_eq!(config.extensions.len(), 1);
|
||||||
@@ -494,6 +500,7 @@ mod tests {
|
|||||||
assert!(config.debug);
|
assert!(config.debug);
|
||||||
assert_eq!(config.max_tool_repetitions, Some(5));
|
assert_eq!(config.max_tool_repetitions, Some(5));
|
||||||
assert!(config.interactive);
|
assert!(config.interactive);
|
||||||
|
assert!(!config.quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -511,6 +518,7 @@ mod tests {
|
|||||||
assert!(!config.debug);
|
assert!(!config.debug);
|
||||||
assert!(config.max_tool_repetitions.is_none());
|
assert!(config.max_tool_repetitions.is_none());
|
||||||
assert!(!config.interactive);
|
assert!(!config.interactive);
|
||||||
|
assert!(!config.quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
Reference in New Issue
Block a user