diff options
| author | 2025-02-05 02:14:25 -0600 | |
|---|---|---|
| committer | 2025-02-05 02:14:25 -0600 | |
| commit | c57853db499ecc8b5c82e64cc8a54d63d76e5bb9 (patch) | |
| tree | 079e0a2e945f2f7bb3ad64ae99b8232cb812d2bb | |
| parent | get started on cli (diff) | |
no changes ignore
| -rw-r--r-- | ozone-cli/src/main.rs | 15 | ||||
| -rw-r--r-- | ozone/src/launcher/settings.rs | 12 |
2 files changed, 12 insertions, 15 deletions
diff --git a/ozone-cli/src/main.rs b/ozone-cli/src/main.rs index b449209..d0d7b21 100644 --- a/ozone-cli/src/main.rs +++ b/ozone-cli/src/main.rs @@ -1,18 +1,17 @@ mod cli; use std::error::Error; -use std::path::PathBuf; -use std::process::{ExitCode, ExitStatus}; +use std::process::ExitCode; use log::{error, info}; -use clap::{Args, Parser, Subcommand}; +use clap::Parser; use ozone::launcher::{Launcher, Settings}; use crate::cli::{Cli, ProfileCommand, RootCommand}; async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> { - let Some(home) = cli.home.or_else(|| Launcher::sensible_home()) else { + let Some(home) = cli.home.or_else(Launcher::sensible_home) else { error!("Could not choose a launcher home directory. Please choose one with `--home'."); - Ok(ExitCode::FAILURE) // we print our own error message + return Ok(ExitCode::FAILURE); // we print our own error message }; info!("Sensible home could be {home:?}"); @@ -22,9 +21,11 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> { match cli.subcmd { RootCommand::Profile(mut p) => match p.take_command() { ProfileCommand::List => { - + todo!() } - } + _ => todo!() + }, + _ => todo!() } Ok(ExitCode::SUCCESS) diff --git a/ozone/src/launcher/settings.rs b/ozone/src/launcher/settings.rs index 5e15604..a050e19 100644 --- a/ozone/src/launcher/settings.rs +++ b/ozone/src/launcher/settings.rs @@ -118,16 +118,12 @@ impl Settings { self.save_to(self.path.as_ref().expect("save() called on Settings instance not loaded from file")).await } - pub fn get_instance(&self, name: &str) -> Option<&Instance> { - self.inner.instances.get(name) + pub fn get_instances(&self) -> &HashMap<String, Instance> { + &self.inner.instances } - pub fn get_profile(&self, name: &str) -> Option<&Profile> { - self.inner.profiles.get(name) - } - - pub fn get_instance_for(&self, profile: &Profile) -> &Instance { - self.inner.instances.get(&profile.instance).unwrap() + pub fn get_profiles(&self) -> &HashMap<String, Profile> { + &self.inner.profiles } pub fn get_client_id(&self) -> Uuid { |
