feat(cli): Improve default behavior when no command is provided (#1438)

This commit is contained in:
Paul Walker
2025-02-28 14:24:14 -05:00
committed by GitHub
parent e799e80eb3
commit e8212c4005

View File

@@ -1,7 +1,6 @@
use anyhow::Result;
use clap::{Args, CommandFactory, Parser, Subcommand};
use clap::{Args, Parser, Subcommand};
use console::style;
use goose::config::Config;
use goose_cli::commands::configure::handle_configure;
use goose_cli::commands::info::handle_info;
@@ -292,14 +291,15 @@ async fn main() -> Result<()> {
return Ok(());
}
None => {
Cli::command().print_help()?;
println!();
if !Config::global().exists() {
println!(
"\n {}: Run '{}' to setup goose for the first time",
style("Tip").green().italic(),
style("goose configure").cyan()
);
let _ = handle_configure().await;
return Ok(());
} else {
// Run session command by default
let mut session = build_session(None, false, vec![], vec![]).await;
setup_logging(session.session_file().file_stem().and_then(|s| s.to_str()))?;
let _ = session.interactive(None).await;
return Ok(());
}
}
}