diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-12 01:29:04 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-12 01:29:04 +0800 |
| commit | 4867dae1235040455624ea792557c72fe7a9b6bf (patch) | |
| tree | dec72809a8ed0aa4edd9520a1537900e62ccabef /mingling | |
| parent | f15e261448238579dc66abf61802e82409a70e61 (diff) | |
Add comments to example completion function
Diffstat (limited to 'mingling')
| -rw-r--r-- | mingling/src/example_docs.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs index b0ef26e..95aee93 100644 --- a/mingling/src/example_docs.rs +++ b/mingling/src/example_docs.rs @@ -119,21 +119,27 @@ pub mod example_basic {} /// /// #[completion(FruitEntry)] /// fn comp_fruit_command(ctx: &ShellContext) -> Suggest { +/// // When the user is filling "--name" for the first time /// if ctx.filling_argument_first("--name") { /// return suggest!(); /// } +/// // When the user is filling "--type" for the first time /// if ctx.filling_argument_first("--type") { /// return suggest! { /// "apple", "banana" /// }; /// } +/// // When the user is typing an argument /// if ctx.typing_argument() { /// return suggest! { /// "--name": "Fruit name", /// "--type": "Fruit type" /// } +/// // Strip already typed arguments /// .strip_typed_argument(ctx); /// } +/// +/// // Return empty suggestion, indicating Shell should not perform any completion logic /// return suggest!(); /// } /// |
