tracel-xtask 4.16.0

Reusable and Extensible xtask commands to manage repositories.
Documentation
use crate::prelude::{Context, Environment};

use super::{
    Target,
    check::{CheckCmdArgs, CheckSubCommand},
    test::{TestCmdArgs, TestSubCommand},
};

#[tracel_xtask_macros::declare_command_args(None, None)]
struct ValidateCmdArgs {}

pub fn handle_command(args: ValidateCmdArgs, env: Environment, ctx: Context) -> anyhow::Result<()> {
    let target = Target::Workspace;
    let exclude = vec![];
    let only = vec![];

    // checks
    [
        CheckSubCommand::Audit,
        CheckSubCommand::Format,
        CheckSubCommand::Lint,
        CheckSubCommand::Typos,
    ]
    .iter()
    .try_for_each(|c| {
        super::check::handle_command(
            CheckCmdArgs {
                target: target.clone(),
                exclude: exclude.clone(),
                only: only.clone(),
                command: Some(c.clone()),
                ignore_audit: args.ignore_audit,
                ignore_typos: args.ignore_typos,
                features: args.features.clone(),
                no_default_features: args.no_default_features,
            },
            env.clone(),
            ctx.clone(),
        )
    })?;

    // tests
    super::test::handle_command(
        TestCmdArgs {
            target: target.clone(),
            exclude: exclude.clone(),
            only: only.clone(),
            threads: None,
            test: None,
            jobs: None,
            command: Some(TestSubCommand::All),
            force: false,
            features: Some(args.features.clone()),
            no_default_features: args.no_default_features,
            no_capture: false,
            miri: None,
            release: args.release,
        },
        env.clone(),
        ctx.clone(),
    )?;

    Ok(())
}