summaryrefslogtreecommitdiffstats
path: root/ozone-cli/src/main.rs
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2025-02-07 01:41:37 -0600
committerLibravatar bigfoot547 <[email protected]>2025-02-07 01:41:37 -0600
commit4f6f6d5d6a2ca04eaf525fbfb6f965e9200bae91 (patch)
tree64782ab98f2746569285ec6d0e3720698fc55164 /ozone-cli/src/main.rs
parentwip: some changes (diff)
more work on cli
Diffstat (limited to 'ozone-cli/src/main.rs')
-rw-r--r--ozone-cli/src/main.rs31
1 files changed, 26 insertions, 5 deletions
diff --git a/ozone-cli/src/main.rs b/ozone-cli/src/main.rs
index 4b04e48..d18e9b8 100644
--- a/ozone-cli/src/main.rs
+++ b/ozone-cli/src/main.rs
@@ -2,7 +2,7 @@ mod cli;
use std::error::Error;
use std::process::ExitCode;
-use log::{error, info};
+use log::{error, info, trace};
use clap::Parser;
use ozone::launcher::{Launcher, Settings};
@@ -14,14 +14,32 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
return Ok(ExitCode::FAILURE); // we print our own error message
};
- info!("Sensible home could be {home:?}");
+ trace!("Sensible home could be {home:?}");
let mut settings = Settings::load(home.join("ozone.json")).await?;
match &cli.subcmd {
RootCommand::Profile(p) => match p.command() {
ProfileCommand::List => {
+ let mut first = true;
+
+ if settings.get_profiles().is_empty() {
+ eprintln!("There are no profiles. Create one with `profile create <name>'.");
+ return Ok(ExitCode::SUCCESS);
+ }
+
for (name, profile) in settings.get_profiles().iter() {
- println!("{name}: {profile:#?}");
+ if !first {
+ println!();
+ }
+
+ first = false;
+
+ let sel = if settings.get_selected_profile_name().is_some_and(|n| n == name) { " (selected)" } else { "" };
+ let exists = if settings.get_instances().contains_key(profile.get_instance_name()) { "" } else { " (missing!)" };
+
+ println!("Profile {name}:{sel}");
+ println!(" Version: {}", profile.get_version());
+ println!(" Instance: {}{}", profile.get_instance_name(), exists);
}
},
ProfileCommand::Create(args) => {
@@ -43,7 +61,10 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
}
// creating a new profile from scratch
-
+ todo!()
+ },
+ ProfileCommand::Select(args) => {
+
}
_ => todo!()
},
@@ -73,7 +94,7 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
async fn main() -> ExitCode {
simple_logger::SimpleLogger::new().env().init().unwrap();
- let arg = dbg!(Cli::parse());
+ let arg = Cli::parse();
main_inner(arg).await.unwrap_or_else(|e| {
error!("Launcher initialization error:");