diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-14 03:26:54 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-14 03:26:54 +0800 |
| commit | b138dff3517e8cb793d431af6ad4a577491e21b0 (patch) | |
| tree | 7ff88d23f76caf62f39dfd2a7e3285fc8e186e63 /mingling_core/src/comp/comp_ctx.rs | |
| parent | a14b9bbb96e025a60abeb492ba043b0db806289a (diff) | |
docs(comp): improve documentation for completion module
Add detailed doc comments, examples, and usage notes across
the completion module including ShellContext, Suggest, and
related traits.
Diffstat (limited to 'mingling_core/src/comp/comp_ctx.rs')
| -rw-r--r-- | mingling_core/src/comp/comp_ctx.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/mingling_core/src/comp/comp_ctx.rs b/mingling_core/src/comp/comp_ctx.rs index f2b83e6..04ef853 100644 --- a/mingling_core/src/comp/comp_ctx.rs +++ b/mingling_core/src/comp/comp_ctx.rs @@ -1,4 +1,3 @@ -// Doc Not Optimize use crate::{COMPLETION_SUBCOMMAND, Program, ProgramCollect}; impl<C> Program<C> @@ -11,6 +10,25 @@ where /// (defined by [`COMPLETION_SUBCOMMAND`]) appears among the parsed arguments. /// When `true`, the program should generate shell completions instead of /// running its normal execution path. + /// + /// # Returns + /// + /// `true` if the program is in completion mode, `false` otherwise. + /// + /// # Example + /// + /// ``` + /// # #[cfg(feature = "comp")] { + /// # use mingling_core::MockProgramCollect as ThisProgram; + /// use mingling_core::Program; + /// + /// let completing = Program::<ThisProgram>::new_with_args(["my_prog", "__comp"]).is_completing(); + /// assert!(completing); + /// + /// let not_completing = Program::<ThisProgram>::new_with_args(["my_prog", "run"]).is_completing(); + /// assert!(!not_completing); + /// # } + /// ``` #[must_use] pub fn is_completing(&self) -> bool { // Check if the first argument (args[1]) is the completion subcommand |
