From 98f56de8b11b563f8323627322fddfb9b39c88c5 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Wed, 5 Feb 2025 12:07:32 -0600 Subject: small cli changes --- ozone-cli/src/cli.rs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'ozone-cli/src/cli.rs') diff --git a/ozone-cli/src/cli.rs b/ozone-cli/src/cli.rs index d288e3c..407ee50 100644 --- a/ozone-cli/src/cli.rs +++ b/ozone-cli/src/cli.rs @@ -1,10 +1,28 @@ use std::path::PathBuf; use clap::{Args, Parser, Subcommand}; +#[derive(Args, Debug)] +pub struct ProfileSelectArgs { + /// The name of the profile to select. + #[arg(index = 1)] + pub profile: String +} + +#[derive(Args, Debug)] +pub struct ProfileCreateArgs { + /// The name of the new profile. + #[arg(index = 1)] + pub name: String, + + /// Clone profile information from an existing profile. + #[arg(long, short = 'c')] + pub clone: String +} + #[derive(Subcommand, Debug)] pub enum ProfileCommand { - Select, - Create, + Select(ProfileSelectArgs), + Create(ProfileCreateArgs), List } @@ -15,8 +33,8 @@ pub struct ProfileArgs { } impl ProfileArgs { - pub fn take_command(&mut self) -> ProfileCommand { - self.subcmd.take().unwrap_or(ProfileCommand::List) + pub fn command(&self) -> &ProfileCommand { + self.subcmd.as_ref().unwrap_or(&ProfileCommand::List) } } @@ -24,7 +42,7 @@ impl ProfileArgs { pub enum RootCommand { Profile(ProfileArgs), Instance, - + Launch } #[derive(Parser, Debug)] -- cgit v1.2.3-70-g09d2