Skip to content

Commit 3a25711

Browse files
authored
Update carapace example to use $env.CARAPACE_LENIENT (#2099)
Unlike the current suggested solution, which is rather hacky, this configuration method is intended.
1 parent 22358f7 commit 3a25711

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

cookbook/external_completers.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,7 @@ Carapace will return this error when a non-supported flag is provided. For examp
8989
| -1ERR | unknown shorthand flag: "1" in -1 |
9090
| -1\_ | |
9191

92-
The solution to this involves manually checking the value to filter it out:
93-
94-
```nu
95-
let carapace_completer = {|spans: list<string>|
96-
carapace $spans.0 nushell ...$spans
97-
| from json
98-
| if ($in | default [] | any {|| $in.display | str starts-with "ERR"}) { null } else { $in }
99-
}
100-
```
92+
The solution to this is to set `$env.CARAPACE_LENIENT = 1`, see [the carapace documentation](https://carapace-sh.github.io/carapace-bin/setup/environment.html#carapace_lenient).
10193

10294
## Putting it all together
10395

@@ -107,9 +99,7 @@ This is an example of how an external completer definition might look like:
10799
let fish_completer = ...
108100
109101
let carapace_completer = {|spans: list<string>|
110-
carapace $spans.0 nushell ...$spans
111-
| from json
112-
| if ($in | default [] | any {|| $in.display | str starts-with "ERR"}) { null } else { $in }
102+
CARAPACE_LENIENT=1 carapace $spans.0 nushell ...$spans | from json
113103
}
114104
115105
# This completer will use carapace by default

0 commit comments

Comments
 (0)