From b138dff3517e8cb793d431af6ad4a577491e21b0 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 14 Aug 2026 03:26:54 +0800 Subject: 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. --- mingling_core/src/comp/comp_ctx.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'mingling_core/src/comp/comp_ctx.rs') 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 Program @@ -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::::new_with_args(["my_prog", "__comp"]).is_completing(); + /// assert!(completing); + /// + /// let not_completing = Program::::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 -- cgit