From 6e05f1ab8d5c45cccff8a58e01a51f8aeccaa0c9 Mon Sep 17 00:00:00 2001 From: amtoine Date: Mon, 20 Mar 2023 19:24:07 +0100 Subject: [PATCH 1/2] add a note about "value / description" completion --- book/custom_completions.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/book/custom_completions.md b/book/custom_completions.md index 9b983dbe62b..5bb6933ad60 100644 --- a/book/custom_completions.md +++ b/book/custom_completions.md @@ -114,6 +114,25 @@ def my_commits [] { } ``` +> **Note** +> with the following snippet +> +> ```nu +> def my-command [commit: string@my_commits] { +> print $commit +> } +> ``` +> +> be aware that, even though the completion menu will show you something like +> +> ```nu +> >_ my-command +> 5c2464 Add .gitignore +> f3a377 Initial commit +> ``` +> +> only the value, i.e. "5c2464" or "f3a377", will be used in the command arguments! + ## External completions External completers can also be integrated, instead of relying solely on Nushell ones. From e9e791fc15217b39554d215ba1135094dfe9366b Mon Sep 17 00:00:00 2001 From: amtoine Date: Mon, 20 Mar 2023 19:36:30 +0100 Subject: [PATCH 2/2] add a newline after the "**Note**" --- book/custom_completions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/custom_completions.md b/book/custom_completions.md index 5bb6933ad60..7bf6f3aa3e6 100644 --- a/book/custom_completions.md +++ b/book/custom_completions.md @@ -115,6 +115,7 @@ def my_commits [] { ``` > **Note** +> > with the following snippet > > ```nu