mod completion;
mod config_schema;
mod exec;
mod gc;
mod install_man_pages;
mod markdown_help;
mod snapshot;
use clap::Subcommand;
use tracing::instrument;
use self::completion::UtilCompletionArgs;
use self::completion::cmd_util_completion;
use self::config_schema::UtilConfigSchemaArgs;
use self::config_schema::cmd_util_config_schema;
use self::exec::UtilExecArgs;
use self::exec::cmd_util_exec;
use self::gc::UtilGcArgs;
use self::gc::cmd_util_gc;
use self::install_man_pages::UtilInstallManPagesArgs;
use self::install_man_pages::cmd_util_install_man_pages;
use self::markdown_help::UtilMarkdownHelp;
use self::markdown_help::cmd_util_markdown_help;
use self::snapshot::UtilSnapshotArgs;
use self::snapshot::cmd_util_snapshot;
use crate::cli_util::CommandHelper;
use crate::command_error::CommandError;
use crate::ui::Ui;
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum UtilCommand {
Completion(UtilCompletionArgs),
ConfigSchema(UtilConfigSchemaArgs),
Exec(UtilExecArgs),
Gc(UtilGcArgs),
InstallManPages(UtilInstallManPagesArgs),
MarkdownHelp(UtilMarkdownHelp),
Snapshot(UtilSnapshotArgs),
}
#[instrument(skip_all)]
pub(crate) async fn cmd_util(
ui: &mut Ui,
command: &CommandHelper,
subcommand: &UtilCommand,
) -> Result<(), CommandError> {
match subcommand {
UtilCommand::Completion(args) => cmd_util_completion(ui, command, args).await,
UtilCommand::ConfigSchema(args) => cmd_util_config_schema(ui, command, args).await,
UtilCommand::Exec(args) => cmd_util_exec(ui, command, args).await,
UtilCommand::Gc(args) => cmd_util_gc(ui, command, args).await,
UtilCommand::InstallManPages(args) => cmd_util_install_man_pages(ui, command, args).await,
UtilCommand::MarkdownHelp(args) => cmd_util_markdown_help(ui, command, args).await,
UtilCommand::Snapshot(args) => cmd_util_snapshot(ui, command, args).await,
}
}