summaryrefslogtreecommitdiffstats
path: root/ozone-cli
diff options
context:
space:
mode:
Diffstat (limited to 'ozone-cli')
-rw-r--r--ozone-cli/src/cli.rs11
-rw-r--r--ozone-cli/src/main.rs23
2 files changed, 32 insertions, 2 deletions
diff --git a/ozone-cli/src/cli.rs b/ozone-cli/src/cli.rs
index 407ee50..281a996 100644
--- a/ozone-cli/src/cli.rs
+++ b/ozone-cli/src/cli.rs
@@ -16,7 +16,16 @@ pub struct ProfileCreateArgs {
/// Clone profile information from an existing profile.
#[arg(long, short = 'c')]
- pub clone: String
+ pub clone: Option<String>,
+
+ /// The Minecraft version to be launched by this profile. Will use the latest release by default.
+ #[arg(long, short = 'v')]
+ pub version: Option<String>,
+
+ /// The instance in which this profile will launch the game. By default, will create a new instance
+ /// with the same name as this profile.
+ #[arg(long, short = 'i')]
+ pub instance: Option<String>
}
#[derive(Subcommand, Debug)]
diff --git a/ozone-cli/src/main.rs b/ozone-cli/src/main.rs
index 346532a..4b04e48 100644
--- a/ozone-cli/src/main.rs
+++ b/ozone-cli/src/main.rs
@@ -15,7 +15,7 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
};
info!("Sensible home could be {home:?}");
- let settings = Settings::load(home.join("ozone.json")).await?;
+ let mut settings = Settings::load(home.join("ozone.json")).await?;
match &cli.subcmd {
RootCommand::Profile(p) => match p.command() {
@@ -23,6 +23,27 @@ async fn main_inner(cli: Cli) -> Result<ExitCode, Box<dyn Error>> {
for (name, profile) in settings.get_profiles().iter() {
println!("{name}: {profile:#?}");
}
+ },
+ ProfileCommand::Create(args) => {
+ if settings.profiles.contains_key(&args.name) {
+ eprintln!("A profile with that name already exists.");
+ return Ok(ExitCode::FAILURE);
+ }
+
+ if let Some(ref src) = args.clone {
+ if let Some(profile) = settings.get_profiles().get(src) {
+ let profile = profile.clone();
+ settings.profiles.insert(args.name.clone(), profile);
+ } else {
+ eprintln!("Unknown profile `{src}'.");
+ return Ok(ExitCode::FAILURE);
+ }
+
+ return Ok(ExitCode::SUCCESS);
+ }
+
+ // creating a new profile from scratch
+
}
_ => todo!()
},