fix: improve 'no command provided' error (#403)

This commit is contained in:
Jarrod Sibbison
2024-12-04 17:49:57 +11:00
committed by GitHub
parent e8a6d768a0
commit 53dd8ab38c
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -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(())
+4
View File
@@ -88,6 +88,10 @@ pub fn find_existing_profile(name: &str) -> Option<Profile> {
}
}
pub fn has_no_profiles() -> Result<bool, Box<dyn Error>> {
load_profiles().map(|profiles| Ok(profiles.is_empty()))?
}
pub fn get_or_set_key(
human_readable_name: &str,
key_name: &str,