Convert nix-info arguments to type-safe clap derive
This commit is contained in:
parent
367c253a47
commit
d55555c1ed
1 changed files with 12 additions and 4 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue