dynamic_cli/plugin/builtin/mod.rs
1//! Standalone, single-command plugins.
2//!
3//! `SystemPlugin` (in [`crate::plugin::system`]) bundles `help`, `version`,
4//! and `exit` into a single plugin. This module offers the same three
5//! commands as **independent** plugins — [`HelpPlugin`], [`VersionPlugin`],
6//! [`ExitPlugin`] — for applications that want to compose only the ones
7//! they need (e.g. `version` alone, without `help`/`exit`).
8//!
9//! # Relationship to `SystemPlugin`
10//!
11//! Each plugin here reuses the exact same handler logic as its
12//! `SystemPlugin` counterpart (`SystemHelpHandler`, `SystemVersionHandler`,
13//! `SystemExitHandler` in [`crate::plugin::system`]) — this is a pure
14//! internal refactor (#44 / DD-025). `SystemPlugin`'s public API, its
15//! `handlers()` output, and its existing test suite are unaffected.
16//!
17//! | Plugin | Implementation name | Behaviour |
18//! |------------------|---------------------|----------------------------------------------|
19//! | [`HelpPlugin`] | `system_help` | Same as `SystemPlugin`'s `system_help` |
20//! | [`VersionPlugin`] | `system_version` | Same as `SystemPlugin`'s `system_version` |
21//! | [`ExitPlugin`] | `system_exit` | Same as `SystemPlugin`'s `system_exit` |
22//!
23//! Implementation names are unchanged, so existing YAML configs that
24//! reference `system_help` / `system_version` / `system_exit` keep working
25//! whether the commands are wired through `SystemPlugin` or through these
26//! granular plugins.
27//!
28//! # Example
29//!
30//! ```
31//! use dynamic_cli::plugin::{Plugin, VersionPlugin};
32//!
33//! // Register only `version`, without `help` or `exit`.
34//! let plugin = VersionPlugin::new();
35//! assert_eq!(plugin.handlers().len(), 1);
36//! ```
37
38mod exit;
39mod help;
40mod version;
41
42#[cfg(feature = "sysinfo-plugin")]
43mod sysinfo;
44
45#[cfg(feature = "env-plugin")]
46mod env;
47
48#[cfg(feature = "config-plugin")]
49mod config;
50
51pub use exit::ExitPlugin;
52pub use help::HelpPlugin;
53pub use version::VersionPlugin;
54
55#[cfg(feature = "sysinfo-plugin")]
56pub use sysinfo::SysInfoPlugin;
57
58#[cfg(feature = "env-plugin")]
59pub use env::EnvPlugin;
60
61#[cfg(feature = "config-plugin")]
62pub use config::ConfigPlugin;