diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-03 01:31:04 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-03 01:31:04 +0800 |
| commit | 8422e0ada52d8036c32257d84f069776e520079e (patch) | |
| tree | b3d3c1aabc40d1c4ab35467fef6f68b6100779a4 /mingling_core/src/asset | |
| parent | 8f44a3e779fb8ee66c8f51b49d6c77e5a80e3821 (diff) | |
Add missing articles and improve documentation
Diffstat (limited to 'mingling_core/src/asset')
| -rw-r--r-- | mingling_core/src/asset/comp.rs | 5 | ||||
| -rw-r--r-- | mingling_core/src/asset/comp/flags.rs | 9 | ||||
| -rw-r--r-- | mingling_core/src/asset/comp/suggest.rs | 10 |
3 files changed, 24 insertions, 0 deletions
diff --git a/mingling_core/src/asset/comp.rs b/mingling_core/src/asset/comp.rs index c1c7ab5..a6299e1 100644 --- a/mingling_core/src/asset/comp.rs +++ b/mingling_core/src/asset/comp.rs @@ -33,6 +33,11 @@ pub trait CompletionEntry { fn get_input(self) -> Vec<String>; } +/// A helper struct for handling command-line completion logic. +/// +/// This struct provides static methods for executing completions based on +/// the current shell context and rendering the resulting suggestions in a +/// format appropriate for the target shell. pub struct CompletionHelper; impl CompletionHelper { pub fn exec_completion<P>(ctx: &ShellContext) -> Suggest diff --git a/mingling_core/src/asset/comp/flags.rs b/mingling_core/src/asset/comp/flags.rs index f61e9ac..452126b 100644 --- a/mingling_core/src/asset/comp/flags.rs +++ b/mingling_core/src/asset/comp/flags.rs @@ -1,13 +1,22 @@ use just_fmt::snake_case; +/// Represents the shell environment for which the output format is intended. +/// +/// This enum defines the supported shell types that can be used for +/// generating shell-specific command syntax, scripts, or completions. #[derive(Default, Debug, Clone)] #[cfg_attr(feature = "general_renderer", derive(serde::Serialize))] pub enum ShellFlag { + /// Represents the Bash shell. #[default] Bash, + /// Represents the Zsh shell. Zsh, + /// Represents the Fish shell. Fish, + /// Represents PowerShell. Powershell, + /// A custom or unsupported shell type, identified by the provided string. Other(String), } diff --git a/mingling_core/src/asset/comp/suggest.rs b/mingling_core/src/asset/comp/suggest.rs index 62844a7..6d64341 100644 --- a/mingling_core/src/asset/comp/suggest.rs +++ b/mingling_core/src/asset/comp/suggest.rs @@ -66,10 +66,20 @@ impl std::ops::DerefMut for Suggest { } } +/// Represents a single suggestion item for shell completion. +/// +/// This enum has two variants: +/// - `Simple(String)`: A suggestion without any description. +/// - `WithDescription(String, String)`: A suggestion with an associated description. +/// +/// The first `String` always holds the suggestion text, and the second `String` (if present) +/// holds an optional description providing additional context. #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "general_renderer", derive(serde::Serialize))] pub enum SuggestItem { + /// A simple suggestion with only the suggestion text. Simple(String), + /// A suggestion with both text and a description. WithDescription(String, String), } |
