Convert nix-info arguments to type-safe clap derive

This commit is contained in:
i1i1 2023-08-10 01:56:36 +03:00 committed by Zhaofeng Li
parent 367c253a47
commit d55555c1ed

View file

@ -1,14 +1,22 @@
use clap::{ArgMatches, Command as ClapCommand}; use clap::{ArgMatches, Args, FromArgMatches, Command};
use crate::error::ColmenaError; use crate::error::ColmenaError;
use crate::nix::evaluator::nix_eval_jobs::get_pinned_nix_eval_jobs; use crate::nix::evaluator::nix_eval_jobs::get_pinned_nix_eval_jobs;
use crate::nix::NixCheck; use crate::nix::NixCheck;
pub fn subcommand() -> ClapCommand { #[derive(Debug, Args)]
ClapCommand::new("nix-info").about("Show information about the current Nix installation") #[command(
name = "nix-info",
about = "Show information about the current Nix installation"
)]
pub struct Opts {}
pub fn subcommand() -> Command {
Opts::augment_args(Command::new("nix-info"))
} }
pub async fn run(_global_args: &ArgMatches, _local_args: &ArgMatches) -> Result<(), ColmenaError> { pub async fn run(_global_args: &ArgMatches, local_args: &ArgMatches) -> Result<(), ColmenaError> {
let Opts {} = Opts::from_arg_matches(local_args).unwrap();
let check = NixCheck::detect().await; let check = NixCheck::detect().await;
check.print_version_info(); check.print_version_info();
check.print_flakes_info(false); check.print_flakes_info(false);