Skip to content

Commit

Permalink
Merge pull request #847 from rsteube/doc-preinvoke
Browse files Browse the repository at this point in the history
doc: PreInvoke
  • Loading branch information
rsteube committed Jul 27, 2023
2 parents 882845e + 22ab9ab commit ba5e94e
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/src/carapace/gen/dashAnyCompletion.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DashAnyCompletion

[`DashAnyCompletion`] defines completion for any positional argument after dash not already defined.
[`DashAnyCompletion`] defines completion for any positional arguments after `--` (dash) not already defined.

```go
carapace.Gen(rootCmd).DashAnyCompletion(
Expand Down
7 changes: 1 addition & 6 deletions docs/src/carapace/gen/dashCompletion.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# DashCompletion

The first `--` (dash) argument that is not a flag argumet disables further flag parsing.
In carapace the positional arguments that follow it are completed using the following functions.
The Context is also updated to only contain the arguments after the dash.

[`DashCompletion`] defines completion for positional arguments after dash using a list of [actions](../action.md).

[`DashCompletion`] defines completion for positional arguments after `--` (dash).

```go
carapace.Gen(rootCmd).DashCompletion(
Expand Down
3 changes: 1 addition & 2 deletions docs/src/carapace/gen/flagCompletion.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# FlagCompletion

[`FlagCompletion`] defines completion for flags using a map consisting of name and [action](../action.md).
[`FlagCompletion`] defines completion for flags.

```go
carapace.Gen(myCmd).FlagCompletion(carapace.ActionMap{
"flagName": carapace.ActionValues("a", "b", "c"),
// ...
})
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/carapace/gen/positionalCompletion.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PositionalCompletion

[`PositionalCompletion`] defines completion for positional arguments using a list of [actions](../action.md).
[`PositionalCompletion`] defines completion for positional arguments.


```go
Expand Down
98 changes: 98 additions & 0 deletions docs/src/carapace/gen/preInvoke.cast
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{"version": 2, "width": 108, "height": 24, "timestamp": 1690468606, "env": {"SHELL": "elvish", "TERM": "tmux-256color"}}
[0.083416, "o", "\u001b[?7h\u001b[7m⏎\u001b[m \r \r\u001b[?7l\u001b[?2004h"]
[0.084147, "o", "\u001b[?25l\r???> ???> \r\u001b[5C\u001b[?25h\u001b[?25l\r\u001b[5C\u001b[K\r\u001b[5C\u001b[?25h"]
[0.095545, "o", "\u001b[?25l\r\r\u001b[5C\u001b[?25h\u001b[?25l\r\u001b[K\r\n\u001b[0;1;36mcarapace\u001b[0;m on \u001b[0;1;35m master\u001b[0;m \u001b[0;1;31m[$!]\u001b[0;m via \u001b[0;1;36m🐹 v1.20.6 \r\n\u001b[0;1;37mesh\u001b[0;m \u001b[0;1;32m❯\u001b[0;m \r\u001b[6C\u001b[?25h"]
[1.151324, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[0;32mg\u001b[0;m\r\u001b[7C\u001b[?25h"]
[1.151463, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"]
[1.152158, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"]
[1.172821, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"]
[1.172883, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"]
[1.658174, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;31mgi\u001b[0;m\r\u001b[8C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[8C\u001b[?25h"]
[1.762537, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;32mgit\u001b[0;m\r\u001b[9C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"]
[1.832005, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[9C \r\u001b[10C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[10C\u001b[?25h"]
[2.275462, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[10Cs\r\u001b[11C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[11C\u001b[?25h"]
[2.392088, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[11Ch\r\u001b[12C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[12C\u001b[?25h"]
[2.431143, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[12Co\r\u001b[13C\u001b[?25h"]
[2.431653, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[13C\u001b[?25h"]
[2.432917, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[13C\u001b[?25h"]
[2.432979, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[13C\u001b[?25h"]
[2.483956, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[13Cw\r\u001b[14C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[14C\u001b[?25h"]
[2.763047, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14C \r\u001b[15C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"]
[3.145833, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[15C\u001b[0;4m023935b\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7m023935b\u001b[0;2;7m (tmp) \u001b[0;m 32b51ec\u001b[0;2m (coveralls: filter third_\r\n\u001b[0;m0cdfd98\u001b[0;2m (log: added separator) \u001b[0;m 38a5413\u001b[0;2m (style: swap loose/strict\r\n\u001b[0;m0e03080\u001b[0;2m (test) \u001b[0;m 395a33d\u001b[0;2m (fix goreleaser) \r\n\u001b[0;m1316601\u001b[0;2m (doc: updated default actions) \u001b[0;m 3980203\u001b[0;2m (Update README.md) \r\n\u001b[0;m1381669\u001b[0;2m (tmp) \u001b[0;m 3c1d4ce\u001b[0;2m (support FlagSet.interspe\r\n\u001b[0;m1418d45\u001b[0;2m (action: added Shift) \u001b[0;m 3d2676c\u001b[0;2m (tmp) \r\n\u001b[0;m173b04b\u001b[0;2m (handle windows volume support in context.Abs) \u001b[0;m 3f79509\u001b[0;2m (action: added Retain) \r\n\u001b[0;m1c0763e\u001b[0;2m (doc: updated structure (no content yet)) \u001b[0;m 4157a2a\u001b[0;2m (limit test files to linu\r\n\u001b[0;m1c59156\u001b[0;2m (traverse: fix shorthand flagseries check) \u001b[0;m 437ada0\u001b[0;2m (tmp) \r\n\u001b[0;m1dce090\u001b[0;2m (spec: support hidden) \u001b[0;m 4556148\u001b[0;2m (tmp) \r\n\u001b[0;m1e2ebf3\u001b[0;2m (InvokedAction: retain - use vararg for consistency with Action) \u001b[0;m 46e8d9a\u001b[0;2m (sandbox: unset LS_COLORS\r\n\u001b[0;m1ea9c3a\u001b[0;2m (Add support for Windows absolute path + fixes to relative paths)\u001b[0;m 4d9f50c\u001b[0;2m (standalone: fix fake hel\r\n\u001b[0;m286b1be\u001b[0;2m (tmp) \u001b[0;m 506a7fd\u001b[0;2m (doc: simpler usage examp\r\n\u001b[0;m2a465fe\u001b[0;2m (env: add `CARAPACE_HIDDEN` to show hidden) \u001b[0;m 528d12f\u001b[0;2m (tmp) \r\n\u001b[0;m2a47898\u001b[0;2m (tmp) \u001b[0;m 54dcd51\u001b[0;2m (tmp) \r\n\u001b[0;m2c08d5e\u001b[0;2m (tmp) \u001b[0;m 58aea7d\u001b[0;2m (tmp) \r\n\u001b[0;m2e131a9\u001b[0;2m (tmp) \u001b[0;m 5d20fce\u001b[0;2m (index on style-internal-\r\n\u001b[0;m2f02319\u001b[0;2m (tmp) \u001b[0;m 5ebfe84\u001b[0;2m (added Action.Split) \r\n\u001b[0;m301b380\u001b[0;2m (tmp) \u001b[0;m 60b7b86\u001b[0;2m (traverse: fix shorthand \r\n\u001b[0;7;35m \u001b[0;35m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0;m\u001b[20A\r\u001b[22C\u001b[?25h"]
[5.584203, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[15C\u001b[K\r\n\u001b[J\u001b[A\r\u001b[15C\u001b[?25h"]
[5.584336, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"]
[5.585028, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"]
[5.974633, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14C\u001b[K\r\u001b[14C\u001b[?25h"]
[6.134162, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[13C\u001b[K\r\u001b[13C\u001b[?25h"]
[6.277299, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[12C\u001b[K\r\u001b[12C\u001b[?25h"]
[6.427907, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[11C\u001b[K\r\u001b[11C\u001b[?25h"]
[6.548215, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[10C\u001b[K\r\u001b[10C\u001b[?25h"]
[6.751258, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[10C-\r\u001b[11C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[11C\u001b[?25h"]
[7.169507, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[11CC\r\u001b[12C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[12C\u001b[?25h"]
[7.630462, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[12C \r\u001b[13C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[13C\u001b[?25h"]
[7.898661, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[13C.\r\u001b[14C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[14C\u001b[?25h"]
[8.094269, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14C.\r\u001b[15C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"]
[8.171139, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[15C/\r\u001b[16C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[16C\u001b[?25h"]
[8.452812, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[16Ce\r\u001b[17C\u001b[?25h"]
[8.452908, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[17C\u001b[?25h"]
[8.554959, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[17Cl\r\u001b[18C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[18C\u001b[?25h"]
[8.65547, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[18Cv\r\u001b[19C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[19C\u001b[?25h"]
[8.719069, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[19Ci\r\u001b[20C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[20C\u001b[?25h"]
[8.989369, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[20Csh/\r\u001b[23C\u001b[?25h"]
[9.622722, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23C \r\u001b[24C\u001b[?25h"]
[9.622788, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"]
[9.79223, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[24Cs\r\u001b[25C\u001b[?25h"]
[9.920223, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[25Ch\r\u001b[26C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[26C\u001b[?25h"]
[9.944085, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[26Co\r\u001b[27C\u001b[?25h"]
[9.944177, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[27C\u001b[?25h"]
[10.017157, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[27Cw\r\u001b[28C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[28C\u001b[?25h"]
[10.132054, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[28C \r\u001b[29C\u001b[?25h"]
[10.132518, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"]
[10.133171, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"]
[10.133394, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"]
[10.361707, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[29C\u001b[0;4m0557e2a\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7m0557e2a\u001b[0;2;7m (pkg/eval/evaltests: Make APIs of special matchers functions.) \u001b[0;m 2b68c2d\u001b[0;2m (Bump dependencies.) \r\n\u001b[0;m058f981\u001b[0;2m (pkg/eval: Fix the equality test in \"has-value\".) \u001b[0;m 2dc067d\u001b[0;2m (Fix some Go build/lint/\r\n\u001b[0;m059a849\u001b[0;2m (pkg/edit/highlight: Highlight arguments to \"del\".) \u001b[0;m 2e1a1e1\u001b[0;2m (Update stat_unix.go) \r\n\u001b[0;m06ac651\u001b[0;2m (Implement `str:fields`) \u001b[0;m 2f8b0f7\u001b[0;2m (LICENSE: Capitalize \"El\r\n\u001b[0;m0adf0ec\u001b[0;2m (Use the unix build tag.) \u001b[0;m 2fe4512\u001b[0;2m (pkg/eval/vals: Make Rep\r\n\u001b[0;m0b2c6d5\u001b[0;2m (.cirrus.yml: Fix OpenBSD image family.) \u001b[0;m 33cca98\u001b[0;2m (pkg/sys/ewindows: Regen\r\n\u001b[0;m0e9287f\u001b[0;2m (vscode/sample.elv: Add trailing newline.) \u001b[0;m 34b115d\u001b[0;2m (Bump prog.DeprecationLe\r\n\u001b[0;m155ea5a\u001b[0;2m (pkg/eval: Bump the sleep time in the test for peach more.) \u001b[0;m 34bd94d\u001b[0;2m (Remove obsolete build c\r\n\u001b[0;m17a41af\u001b[0;2m (vscode: Bump dependencies and version number.) \u001b[0;m 34cc365\u001b[0;2m (pkg/cli/modes: Fix the \r\n\u001b[0;m1974b30\u001b[0;2m (pkg/lsp: Store parse results synchronously; add tests for hover.)\u001b[0;m 360102f\u001b[0;2m (Advertise 0.19.2 as the\r\n\u001b[0;m19bd75d\u001b[0;2m (pkg/eval: Make the peach test cases print $best-run on failure.) \u001b[0;m 37f8c47\u001b[0;2m (Update VersionBase to 0\r\n\u001b[0;m1a65886\u001b[0;2m (Make vscode/LICENSE a copy of LICENSE.) \u001b[0;m 3820769\u001b[0;2m (elv.sh/get: add instruc\r\n\u001b[0;m1e249ed\u001b[0;2m (pkg/eval.cmp -> pkg/eval/vals.Cmp.) \u001b[0;m 3845a2c\u001b[0;2m (Expose stack traces in \r\n\u001b[0;m2493659\u001b[0;2m (.cirrus.yml: Bump NetBSD to 9.3.) \u001b[0;m 3dad55a\u001b[0;2m (Remove some external co\r\n\u001b[0;m25a1a7b\u001b[0;2m (0.20.0 release notes: Document the new LSP hover support.) \u001b[0;m 3f4bbff\u001b[0;2m (pkg/eval: Add option fo\r\n\u001b[0;m25e27d6\u001b[0;2m (pkg/eval/vals: Make Cmp(a, b) return CmpEqual if Equal(a, b).) \u001b[0;m 4172348\u001b[0;2m (Fix exception capture e\r\n\u001b[0;m278cce6\u001b[0;2m (pkg/lsp: Fix display of code blocks in on-hover docs.) \u001b[0;m 4187d41\u001b[0;2m (pkg/cli: Notify about u\r\n\u001b[0;m27f34b8\u001b[0;2m (pkg/lsp: Return doc when hovering on the first character of a ..)\u001b[0;m 4b67567\u001b[0;2m (Bump required Go versio\r\n\u001b[0;m2a4740a\u001b[0;2m (pkg/sys/eunix: Simplify build constraints for the termiosFlag ..)\u001b[0;m 531ea80\u001b[0;2m (Bump version of staticc\r\n\u001b[0;7;35m \u001b[0;35m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0;m\u001b[20A\r\u001b[22C\u001b[?25h"]
[14.167952, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[29C\u001b[K\r\n\u001b[J\u001b[A\r\u001b[29C\u001b[?25h"]
[14.168069, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"]
[14.168808, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"]
[14.169126, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"]
[14.554689, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[28C\u001b[K\r\u001b[28C\u001b[?25h"]
[15.155578, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[27C\u001b[K\r\u001b[27C\u001b[?25h"]
[15.1954, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[26C\u001b[K\r\u001b[26C\u001b[?25h"]
[15.235606, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[25C\u001b[K\r\u001b[25C\u001b[?25h"]
[15.275349, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[24C\u001b[K\r\u001b[24C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"]
[15.314775, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23C\u001b[K\r\u001b[23C\u001b[?25h"]
[15.35515, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[22C\u001b[K\r\u001b[22C\u001b[?25h"]
[15.394191, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[21C\u001b[K\r\u001b[21C\u001b[?25h"]
[15.435122, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[20C\u001b[K\r\u001b[20C\u001b[?25h"]
[15.474633, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[19C\u001b[K\r\u001b[19C\u001b[?25h"]
[15.514912, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[18C\u001b[K\r\u001b[18C\u001b[?25h"]
[15.554961, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[17C\u001b[K\r\u001b[17C\u001b[?25h"]
[15.594752, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[16C\u001b[K\r\u001b[16C\u001b[?25h"]
[15.635143, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[15C\u001b[K\r\u001b[15C\u001b[?25h"]
[15.741901, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14C\u001b[K\r\u001b[14C\u001b[?25h"]
[15.911831, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[13C\u001b[K\r\u001b[13C\u001b[?25h"]
[16.165314, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[13C/\r\u001b[14C\u001b[?25h"]
[16.165406, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[14C\u001b[?25h"]
[16.370466, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14Ct\r\u001b[15C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"]
[16.472043, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[15Cm\r\u001b[16C\u001b[?25h"]
[16.623084, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[16Cp/\r\u001b[18C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[18C\u001b[?25h"]
[17.050542, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[18C \r\u001b[19C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[19C\u001b[?25h"]
[17.190621, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[19Cs\r\u001b[20C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[20C\u001b[?25h"]
[17.319039, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[20Ch\r\u001b[21C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[21C\u001b[?25h"]
[17.364851, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[21Co\r\u001b[22C\u001b[?25h"]
[17.36551, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[22C\u001b[?25h"]
[17.409142, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[22Cw\r\u001b[23C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[23C\u001b[?25h"]
[17.501947, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23C \r\u001b[24C\u001b[?25h"]
[17.502036, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"]
[17.946912, "o", "\u001b[?25l\u001b[2A\r\u001b[0;31merror: \u001b[0;mfatal: not a git repository (or any parent up to mount point /)\u001b[K\r\n\u001b[0;31merror:\u001b[0;m no candidates\u001b[K\r\n\u001b[K\r\n\u001b[K\u001b[0;1;36mcarapace\u001b[0;m on \u001b[0;1;35m master\u001b[0;m \u001b[0;1;31m[$!]\u001b[0;m via \u001b[0;1;36m🐹 v1.20.6 \r\n\u001b[0;1;37mesh\u001b[0;m \u001b[0;1;32m❯\u001b[0;m \u001b[0;32mgit\u001b[0;m -C /tmp/ show \r\u001b[24C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"]
[20.91478, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\r\u001b[6C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"]
[20.915483, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"]
[20.931791, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"]
[20.931938, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"]
[21.217464, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[0;31me\u001b[0;m\r\u001b[7C\u001b[?25h"]
[21.217564, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"]
[21.391125, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[7C\u001b[0;31mx\u001b[0;m\r\u001b[8C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[8C\u001b[?25h"]
[21.502706, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[8C\u001b[0;31mi\u001b[0;m\r\u001b[9C\u001b[?25h"]
[21.502803, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"]
[21.611975, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;32mexit\u001b[0;m\r\u001b[10C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[10C\u001b[?25h"]
[21.717409, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\n\r\u001b[?25h\u001b[?7h\u001b[?2004l\r"]
13 changes: 13 additions & 0 deletions docs/src/carapace/gen/preInvoke.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# PreInvoke

[`PreInvoke`] is called after arguments are parsed and allows generic modification of an [Action] before it is invoked.

```go
carapace.Gen(rootCmd).PreInvoke(func(cmd *cobra.Command, flag *pflag.Flag, action carapace.Action) carapace.Action {
return action.Chdir(rootCmd.Flag("C").Value.String())
})
```

![](./preInvoke.cast)

[Action]:../action.md
[`PreInvoke`]:https://pkg.go.dev/github.com/rsteube/carapace#Carapace.PreInvoke

0 comments on commit ba5e94e

Please sign in to comment.