dev_scope/doctor/
cli.rs

1use super::commands::*;
2use crate::shared::prelude::FoundConfig;
3use anyhow::Result;
4use clap::{Args, Subcommand};
5
6#[derive(Debug, Args)]
7pub struct DoctorArgs {
8    #[clap(subcommand)]
9    command: DoctorCommands,
10}
11
12#[derive(Debug, Subcommand)]
13enum DoctorCommands {
14    /// Run checks against your machine, generating support output.
15    Run(DoctorRunArgs),
16    /// List all doctor config, giving you the ability to know what is possible
17    List(DoctorListArgs),
18    /// Create an example config file
19    #[command(hide(true))]
20    Init(DoctorInitArgs),
21}
22
23pub async fn doctor_root(found_config: &FoundConfig, args: &DoctorArgs) -> Result<i32> {
24    match &args.command {
25        DoctorCommands::List(args) => doctor_list(found_config, args).await.map(|_| 0),
26        DoctorCommands::Run(args) => doctor_run(found_config, args).await,
27        DoctorCommands::Init(args) => doctor_init(found_config, args).await.map(|_| 0),
28    }
29}