diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-17 07:35:42 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-17 07:35:42 +0800 |
| commit | 40bb7ffd6954184fac718c8f99c9cdc3e054e4eb (patch) | |
| tree | 3b152edba07fa561b6e2792fcaa4c3f7141f3b35 /examples/example-completion/src | |
| parent | c6ab865d5b19e3a57b76562adb9540cbf03d77c4 (diff) | |
feat(macros)!: change completion context parameter to owned type
BREAKING CHANGE: `#[completion]` functions must now take `ShellContext`
by value instead of `&ShellContext`. Reference parameters are reserved
for resource injection.
Diffstat (limited to 'examples/example-completion/src')
| -rw-r--r-- | examples/example-completion/src/main.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/example-completion/src/main.rs b/examples/example-completion/src/main.rs index e14326f..389cf74 100644 --- a/examples/example-completion/src/main.rs +++ b/examples/example-completion/src/main.rs @@ -56,12 +56,12 @@ fn main() { } // --------- IMPORTANT --------- -// __________________________________________ Entry point bound to completion behavior -// / _________________________ Shell context for obtaining user input state -// | / ________ Suggest, used to return completion results -// vvvvvvvvvv | / -#[completion(EntryGreet)] // vvvvvvvvvvvv vvvvvvv -fn complete_greet_entry(ctx: &ShellContext) -> Suggest { +// _________________________________________ Entry point bound to completion behavior +// / _________________________ Shell context for obtaining user input state +// | / ________ Suggest, used to return completion results +// vvvvvvvvvv | / +#[completion(EntryGreet)] // vvvvvvvvvvvv vvvvvvv +fn complete_greet_entry(ctx: ShellContext) -> Suggest { // When the previous word is `greet` (the current command being typed) if ctx.previous_word == "greet" { // Return suggestions |
