mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: improve 'no command provided' error (#403)
This commit is contained in:
@@ -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(())
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user