From 53dd8ab38c8f29dc90874d4d37bc800ca17fa213 Mon Sep 17 00:00:00 2001 From: Jarrod Sibbison <72240382+jsibbison-square@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:49:57 +1100 Subject: [PATCH] fix: improve 'no command provided' error (#403) --- crates/goose-cli/src/main.rs | 6 +++++- crates/goose-cli/src/profile.rs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/goose-cli/src/main.rs b/crates/goose-cli/src/main.rs index 400ece026e..0ed7a5f979 100644 --- a/crates/goose-cli/src/main.rs +++ b/crates/goose-cli/src/main.rs @@ -17,6 +17,7 @@ use clap::{Parser, Subcommand}; use commands::configure::handle_configure; use commands::session::build_session; use commands::version::print_version; +use profile::has_no_profiles; use std::io::{self, Read}; use crate::systems::system_handler::{add_system, remove_system}; @@ -258,7 +259,10 @@ async fn main() -> Result<()> { return Ok(()); } None => { - println!("No command provided"); + println!("No command provided - Run 'goose help' to see available commands."); + if has_no_profiles().unwrap_or(false) { + println!("\nRun 'goose configure' to setup goose for the first time."); + } } } Ok(()) diff --git a/crates/goose-cli/src/profile.rs b/crates/goose-cli/src/profile.rs index 9b65434594..5d87a3c0a2 100644 --- a/crates/goose-cli/src/profile.rs +++ b/crates/goose-cli/src/profile.rs @@ -88,6 +88,10 @@ pub fn find_existing_profile(name: &str) -> Option { } } +pub fn has_no_profiles() -> Result> { + load_profiles().map(|profiles| Ok(profiles.is_empty()))? +} + pub fn get_or_set_key( human_readable_name: &str, key_name: &str,