make subcommand required

This commit is contained in:
Daylin Morgan 2024-03-27 03:31:29 -05:00
parent c27b4dde70
commit 1065433ba5
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -21,7 +21,7 @@ struct Cli {
no_pinix: bool,
#[command(subcommand)]
command: Option<Commands>,
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),
}
}