-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #915 from rsteube/uniquelistf
Action: added UniqueListF
- Loading branch information
Showing
7 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# UniqueListF | ||
|
||
[`UniqueListF`] is like [UniqueList] but uses a function to transform values before filtering. | ||
|
||
```go | ||
carapace.ActionMultiPartsN(":", 2, func(c carapace.Context) carapace.Action { | ||
switch len(c.Parts) { | ||
case 0: | ||
return carapace.ActionValues("one", "two", "three") | ||
default: | ||
return carapace.ActionValues("1", "2", "3") | ||
} | ||
}).UniqueListF(",", func(s string) string { | ||
return strings.SplitN(s, ":", 2)[0] | ||
}) | ||
``` | ||
|
||
![](./uniquelistF.cast) | ||
|
||
[UniqueList]:./uniqueList.md | ||
[`UniqueListF`]: https://pkg.go.dev/github.com/rsteube/carapace#Action.UniqueListF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{"version": 2, "width": 108, "height": 24, "timestamp": 1694682747, "env": {"SHELL": "elvish", "TERM": "tmux-256color"}} | ||
[0.091087, "o", "\u001b[?7h\u001b[7m⏎\u001b[m \r \r\u001b[?7l\u001b[?2004h\u001b[?25l\r???> ???> \r\u001b[5C\u001b[?25h\u001b[?25l\r\u001b[5C\u001b[K\r\u001b[5C\u001b[?25h"] | ||
[0.102225, "o", "\u001b[?25l\r\r\u001b[5C\u001b[?25h\u001b[?25l\r\u001b[K\r\n\u001b[0;1;36mcarapace/example\u001b[0;m on \u001b[0;1;35m uniquelistf\u001b[0;m \u001b[0;1;31m[$!?]\u001b[0;m via \u001b[0;1;36m🐹 v1.21.0 \r\n\u001b[0;1;37mesh\u001b[0;m \u001b[0;1;32m❯\u001b[0;m \r\u001b[6C\u001b[?25h"] | ||
[0.582033, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[0;31me\u001b[0;m\r\u001b[7C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.582758, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.59958, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.790332, "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"] | ||
[0.940353, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;32mexa\u001b[0;m\r\u001b[9C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"] | ||
[1.088234, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;31mexam\u001b[0;m\r\u001b[10C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[10C\u001b[?25h"] | ||
[1.088895, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[10C\u001b[?25h"] | ||
[1.160982, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[10C\u001b[0;31mp\u001b[0;m\r\u001b[11C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[11C\u001b[?25h"] | ||
[1.306839, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[11C\u001b[0;31ml\u001b[0;m\r\u001b[12C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[12C\u001b[?25h"] | ||
[1.394217, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;32mexample\u001b[0;m\r\u001b[13C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[13C\u001b[?25h"] | ||
[1.503183, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[13C \r\u001b[14C\u001b[?25h"] | ||
[1.503453, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[14C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[14C\u001b[?25h"] | ||
[2.279875, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14Cm\r\u001b[15C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"] | ||
[2.338539, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[15Co\r\u001b[16C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[16C\u001b[?25h"] | ||
[2.521556, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[16Cdifier \r\u001b[23C\u001b[?25h"] | ||
[3.096331, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23C-\r\u001b[24C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"] | ||
[3.250586, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[24C-\r\u001b[25C\u001b[?25h"] | ||
[3.25105, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[25C\u001b[?25h"] | ||
[3.617128, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[25Cu\r\u001b[26C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[26C\u001b[?25h"] | ||
[3.825929, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23C\u001b[K\u001b[0;4m--uniquelist \r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7;34m--uniquelist\u001b[0;2;7m (UniqueList())\u001b[0;m \u001b[0;34m--uniquelistf\u001b[0;2m (UniqueListF())\u001b[0;m \u001b[0;34m--usage\u001b[0;2m (Usage())\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[4.550181, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[35C\u001b[K\u001b[0;4mf \r\n\r\n\u001b[0;m\u001b[K\u001b[0;34m--uniquelist\u001b[0;2m (UniqueList())\u001b[0;m \u001b[0;7;34m--uniquelistf\u001b[0;2;7m (UniqueListF())\u001b[0;m \u001b[0;34m--usage\u001b[0;2m (Usage())\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[4.995452, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[23C\u001b[K--uniquelistf \r\n\u001b[J\u001b[A\r\u001b[37C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[37C\u001b[?25h"] | ||
[5.28154, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C\u001b[0;4mone\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7mone\u001b[0;m three two\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[6.194556, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[37C\u001b[Kone\r\n\u001b[J\u001b[A\r\u001b[40C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[40C\u001b[?25h"] | ||
[6.19476, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[40C\u001b[?25h"] | ||
[6.479322, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[40C,\r\u001b[41C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[41C\u001b[?25h"] | ||
[6.668645, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;4;33m'one,three'\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7mthree\u001b[0;m two\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[7.731535, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[43C\u001b[K\u001b[0;4;33mwo'\r\n\r\n\u001b[0;m\u001b[Kthree \u001b[0;7mtwo\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[8.162898, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;33m'one,two'\u001b[0;m\r\n\u001b[J\u001b[A\r\u001b[46C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[46C\u001b[?25h"] | ||
[8.573746, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[46C:\r\u001b[47C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[47C\u001b[?25h"] | ||
[8.736582, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;4;33m'one,two:1'\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7m1\u001b[0;m 2 3\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[9.834408, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[46C\u001b[K\u001b[0;4;33m2'\r\n\r\n\u001b[0;m\u001b[K1 \u001b[0;7m2\u001b[0;m 3\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[10.001731, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[46C\u001b[K\u001b[0;4;33m3'\r\n\r\n\u001b[3C\u001b[0;m\u001b[K2 \u001b[0;7m3\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[10.324615, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;33m'one,two:3'\u001b[0;m\r\n\u001b[J\u001b[A\r\u001b[48C\u001b[?25h"] | ||
[10.324989, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[48C\u001b[?25h"] | ||
[10.626786, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[48C,\r\u001b[49C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[49C\u001b[?25h"] | ||
[10.786717, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;4;33m'one,two:3,three'\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7mthree\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[12.787606, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;33m'one,two:3'\u001b[0;m,\r\n\u001b[J\u001b[A\r\u001b[49C\u001b[?25h"] | ||
[12.861918, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[48C\u001b[K\r\u001b[48C\u001b[?25h"] | ||
[13.210571, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[47C\u001b[K\r\u001b[47C\u001b[?25h"] | ||
[13.449253, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[46C\u001b[K\r\u001b[46C\u001b[?25h"] | ||
[13.592234, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[45C\u001b[K\r\u001b[45C\u001b[?25h"] | ||
[13.739044, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[44C\u001b[K\r\u001b[44C\u001b[?25h"] | ||
[13.890422, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[43C\u001b[K\r\u001b[43C\u001b[?25h"] | ||
[14.053322, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[42C\u001b[K\r\u001b[42C\u001b[?25h"] | ||
[14.219239, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[41C\u001b[K\r\u001b[41C\u001b[?25h"] | ||
[14.488777, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[41C\u001b[0;33m:\u001b[0;m\r\u001b[42C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[42C\u001b[?25h"] | ||
[15.47657, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[42C\u001b[0;33m2\u001b[0;m\r\u001b[43C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[43C\u001b[?25h"] | ||
[15.810041, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[43C\u001b[0;33m,\u001b[0;m\r\u001b[44C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[44C\u001b[?25h"] | ||
[15.943412, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[44C\u001b[0;33mt\u001b[0;m\r\u001b[45C\u001b[?25h"] | ||
[16.41713, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;4;33m'one:2,three'\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7mthree\u001b[0;m two\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[17.549515, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[45C\u001b[K\u001b[0;4;33mwo'\r\n\r\n\u001b[0;m\u001b[Kthree \u001b[0;7mtwo\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[17.748346, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[45C\u001b[K\u001b[0;4;33mhree'\r\n\r\n\u001b[0;m\u001b[K\u001b[0;7mthree\u001b[0;m two\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[18.276919, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[37C\u001b[K\u001b[0;33m'one:2,three'\u001b[0;m\r\n\u001b[J\u001b[A\r\u001b[50C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[50C\u001b[?25h"] | ||
[19.703498, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\r\u001b[6C\u001b[?25h"] | ||
[19.704296, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.704376, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.704803, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.70501, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.705134, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.705233, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.705377, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.70546, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.706261, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.706466, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.706616, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.706719, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.706894, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.722774, "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.010591, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[0;31me\u001b[0;m\r\u001b[7C\u001b[?25h"] | ||
[20.010719, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[20.206386, "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"] | ||
[20.367747, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[8C\u001b[0;31mi\u001b[0;m\r\u001b[9C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"] | ||
[20.470616, "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"] | ||
[20.582785, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\n\r\u001b[?25h\u001b[?7h\u001b[?2004l\r"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters