From 1065433ba596771d039a19f37f2aaec05224ea6a Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 27 Mar 2024 03:31:29 -0500 Subject: [PATCH] make subcommand required --- pkgs/oizys-rs/src/main.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/pkgs/oizys-rs/src/main.rs b/pkgs/oizys-rs/src/main.rs index 05af30d..cf33c11 100644 --- a/pkgs/oizys-rs/src/main.rs +++ b/pkgs/oizys-rs/src/main.rs @@ -21,7 +21,7 @@ struct Cli { no_pinix: bool, #[command(subcommand)] - command: Option, + command: Commands, } #[derive(Debug, Subcommand)] @@ -155,16 +155,12 @@ fn main() { println!("{:?}", oizys) } - if let Some(command) = &cli.command { - match command { - Commands::Dry {} => oizys.build(true), - Commands::Build {} => oizys.build(false), - Commands::Path {} => println!("{}", oizys.output()), - Commands::Boot {} => oizys.nixos_rebuild("boot"), - Commands::Switch {} => oizys.nixos_rebuild("switch"), - Commands::Cache { name } => oizys.cache(name), - } - } else { - println!("No command given") + match &cli.command { + Commands::Dry {} => oizys.build(true), + Commands::Build {} => oizys.build(false), + Commands::Path {} => println!("{}", oizys.output()), + Commands::Boot {} => oizys.nixos_rebuild("boot"), + Commands::Switch {} => oizys.nixos_rebuild("switch"), + Commands::Cache { name } => oizys.cache(name), } }