Skip to main content

ralph/commands/plugin/
mod.rs

1//! Plugin command facade.
2//!
3//! Responsibilities:
4//! - Route plugin subcommands to focused handlers.
5//! - Keep plugin command entrypoints thin and behavior-grouped.
6//!
7//! Not handled here:
8//! - CLI argument parsing (see `crate::cli::plugin`).
9//! - Plugin discovery/registry internals (see `crate::plugins`).
10//!
11//! Invariants/assumptions:
12//! - Subcommand behavior stays delegated to focused helper modules.
13//! - This facade preserves the existing plugin CLI contracts.
14
15mod common;
16mod init;
17mod install;
18mod list;
19mod templates;
20mod validate;
21
22use anyhow::Result;
23
24use crate::cli::plugin::{PluginArgs, PluginCommand};
25use crate::config::Resolved;
26
27pub fn run(args: &PluginArgs, resolved: &Resolved) -> Result<()> {
28    match &args.command {
29        PluginCommand::List { json } => list::run_list(resolved, *json),
30        PluginCommand::Validate { id } => validate::run_validate(resolved, id.as_deref()),
31        PluginCommand::Install { source, scope } => install::run_install(resolved, source, *scope),
32        PluginCommand::Uninstall { id, scope } => install::run_uninstall(resolved, id, *scope),
33        PluginCommand::Init(init_args) => init::run_init(resolved, init_args),
34    }
35}