-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
130 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{"version": 2, "width": 108, "height": 24, "timestamp": 1669550451, "env": {"SHELL": "elvish", "TERM": "tmux-256color"}} | ||
[0.044163, "o", "\u001b[?7h\u001b[7m⏎\u001b[m \r \r\u001b[?7l\u001b[?2004h"] | ||
[0.044735, "o", "\u001b[?25l\r???> ???> \r\u001b[5C\u001b[?25h\u001b[?25l\r\u001b[5C\u001b[K\r\u001b[5C\u001b[?25h"] | ||
[0.056767, "o", "\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.19.3 \r\n\u001b[0;1;37mesh\u001b[0;m \u001b[0;1;32m❯\u001b[0;m \r\u001b[6C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[0.410973, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[0;31me\u001b[0;m\r\u001b[7C\u001b[?25h"] | ||
[0.411205, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.411831, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.424079, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.424121, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[7C\u001b[?25h"] | ||
[0.596996, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;32mex\u001b[0;m\r\u001b[8C\u001b[?25h"] | ||
[0.703495, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[8C\u001b[0;32ma\u001b[0;m\r\u001b[9C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"] | ||
[0.703573, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"] | ||
[0.82484, "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"] | ||
[0.824965, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[10C\u001b[?25h"] | ||
[0.873857, "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"] | ||
[0.982693, "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.059134, "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.137217, "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"] | ||
[1.155561, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[14Ca\r\u001b[15C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[15C\u001b[?25h"] | ||
[1.302186, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[15Cc\r\u001b[16C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[16C\u001b[?25h"] | ||
[1.508561, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[16Ct\r\u001b[17C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[17C\u001b[?25h"] | ||
[1.582351, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[17Ci\r\u001b[18C\u001b[?25h"] | ||
[1.582477, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[18C\u001b[?25h"] | ||
[1.650101, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[18Co\r\u001b[19C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[19C\u001b[?25h"] | ||
[1.690332, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[19Cn\r\u001b[20C\u001b[?25h"] | ||
[1.784619, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[20C \r\u001b[21C\u001b[?25h"] | ||
[1.785154, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[21C\u001b[?25h"] | ||
[2.140353, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[21C-\r\u001b[22C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[22C\u001b[?25h"] | ||
[2.313936, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[22C-\r\u001b[23C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[23C\u001b[?25h"] | ||
[2.769566, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23Cc\r\u001b[24C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"] | ||
[2.808554, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[24Ca\r\u001b[25C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[25C\u001b[?25h"] | ||
[3.105275, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[25Cllback \r\u001b[32C\u001b[?25h"] | ||
[3.667726, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[32C\u001b[0;4mERR\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;1;7;31mERR\u001b[0;2;7;37m (values flag is not set)\u001b[0;m _\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[5.20665, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[32C\u001b[K\r\n\u001b[J\u001b[A\r\u001b[32C\u001b[?25h"] | ||
[5.881772, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[31C\u001b[K\r\u001b[31C\u001b[?25h"] | ||
[6.018095, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[30C\u001b[K\r\u001b[30C\u001b[?25h"] | ||
[6.16999, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[29C\u001b[K\r\u001b[29C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[29C\u001b[?25h"] | ||
[6.317145, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[28C\u001b[K\r\u001b[28C\u001b[?25h"] | ||
[6.461138, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[27C\u001b[K\r\u001b[27C\u001b[?25h"] | ||
[6.613347, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[26C\u001b[K\r\u001b[26C\u001b[?25h"] | ||
[6.767897, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[25C\u001b[K\r\u001b[25C\u001b[?25h"] | ||
[6.92595, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[24C\u001b[K\r\u001b[24C\u001b[?25h"] | ||
[7.062324, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23C\u001b[K\r\u001b[23C\u001b[?25h"] | ||
[7.153565, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[23Cv\r\u001b[24C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[24C\u001b[?25h"] | ||
[7.214558, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[24Ca\r\u001b[25C\u001b[?25h"] | ||
[7.464775, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[25Clues\r\u001b[29C\u001b[?25h"] | ||
[7.883926, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[21C\u001b[K\u001b[0;4m--values \r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7m--values\u001b[0;2;7;37m (ActionValues())\u001b[0;m --values-described\u001b[0;2;37m (ActionValuesDescribed())\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[8.644254, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[21C\u001b[K--values \r\n\u001b[J\u001b[A\r\u001b[30C\u001b[?25h"] | ||
[8.64479, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[30C\u001b[?25h"] | ||
[8.811362, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[30C\u001b[0;4mfirst \r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7mfirst\u001b[0;m second third\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[9.344486, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[30C\u001b[Kfirst \r\n\u001b[J\u001b[A\r\u001b[36C\u001b[?25h"] | ||
[9.344791, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[36C\u001b[?25h"] | ||
[9.737343, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[36C-\r\u001b[37C\u001b[?25h"] | ||
[9.737688, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[37C\u001b[?25h"] | ||
[9.890081, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C-\r\u001b[38C\u001b[?25h"] | ||
[9.890388, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[38C\u001b[?25h"] | ||
[10.093689, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[38Cc\r\u001b[39C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[39C\u001b[?25h"] | ||
[10.132263, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[39Ca\r\u001b[40C\u001b[?25h"] | ||
[10.132589, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[40C\u001b[?25h"] | ||
[10.355928, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[40Cllback \r\u001b[47C\u001b[?25h"] | ||
[10.678464, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[47C\u001b[0;4mERR\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;1;7;31mERR\u001b[0;2;7;37m (values flag is set to: 'first')\u001b[0;m _\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[12.151831, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\r\n\r\n\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[12.151959, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\r\n\r\n\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[12.294166, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\r\n\r\n\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[12.852386, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\r\n\r\n\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[12.852863, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\r\n\r\n\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[13.462558, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[47C\u001b[K\r\n\u001b[J\u001b[A\r\u001b[47C\u001b[?25h"] | ||
[13.740154, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[46C\u001b[K\r\u001b[46C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[46C\u001b[?25h"] | ||
[14.340555, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[45C\u001b[K\r\u001b[45C\u001b[?25h"] | ||
[14.38056, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[44C\u001b[K\r\u001b[44C\u001b[?25h"] | ||
[14.42056, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[43C\u001b[K\r\u001b[43C\u001b[?25h"] | ||
[14.46027, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[42C\u001b[K\r\u001b[42C\u001b[?25h"] | ||
[14.499441, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[41C\u001b[K\r\u001b[41C\u001b[?25h"] | ||
[14.539221, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[40C\u001b[K\r\u001b[40C\u001b[?25h"] | ||
[14.580557, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[39C\u001b[K\r\u001b[39C\u001b[?25h"] | ||
[14.620426, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[38C\u001b[K\r\u001b[38C\u001b[?25h"] | ||
[14.662161, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C\u001b[K\r\u001b[37C\u001b[?25h"] | ||
[14.662226, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[37C\u001b[?25h"] | ||
[14.699829, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[36C\u001b[K\r\u001b[36C\u001b[?25h"] | ||
[14.739967, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[35C\u001b[K\r\u001b[35C\u001b[?25h"] | ||
[14.7798, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[34C\u001b[K\r\u001b[34C\u001b[?25h"] | ||
[14.81953, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[33C\u001b[K\r\u001b[33C\u001b[?25h"] | ||
[14.965694, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[32C\u001b[K\r\u001b[32C\u001b[?25h"] | ||
[15.122062, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[31C\u001b[K\r\u001b[31C\u001b[?25h"] | ||
[15.242773, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[30C\u001b[K\r\u001b[30C\u001b[?25h"] | ||
[15.481103, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[30C\u001b[0;4mfirst \r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;7mfirst\u001b[0;m second third\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[15.80491, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[30C\u001b[K\u001b[0;4msecond \r\n\r\n\u001b[0;m\u001b[Kfirst \u001b[0;7msecond\u001b[0;m third\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[16.089086, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[30C\u001b[K\u001b[0;4mthird \r\n\r\n\u001b[7C\u001b[0;m\u001b[Ksecond \u001b[0;7mthird\u001b[0;m\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[16.413327, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[30C\u001b[Kthird \r\n\u001b[J\u001b[A\r\u001b[36C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[36C\u001b[?25h"] | ||
[16.823152, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[36C-\r\u001b[37C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[37C\u001b[?25h"] | ||
[16.980199, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[37C-\r\u001b[38C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[38C\u001b[?25h"] | ||
[17.175356, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[38Cc\r\u001b[39C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[39C\u001b[?25h"] | ||
[17.208022, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[39Ca\r\u001b[40C\u001b[?25h"] | ||
[17.208134, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[40C\u001b[?25h"] | ||
[17.445591, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[40Cllback \r\u001b[47C\u001b[?25h"] | ||
[17.774788, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[47C\u001b[0;4mERR\r\n\u001b[0;1;37;45m COMPLETING argument \u001b[0;m \r\n\u001b[0;1;7;31mERR\u001b[0;2;7;37m (values flag is set to: 'third')\u001b[0;m _\u001b[1A\r\u001b[22C\u001b[?25h"] | ||
[18.824146, "o", "\u001b[?25l\u001b[3A\r\r\n\r\n\u001b[47C\u001b[K\r\n\u001b[J\u001b[A\r\u001b[47C\u001b[?25h"] | ||
[19.371119, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\r\u001b[6C\u001b[?25h"] | ||
[19.371512, "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"] | ||
[19.372414, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.388355, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[19.388591, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[6C\u001b[?25h"] | ||
[20.043494, "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"] | ||
[20.239111, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;32mex\u001b[0;m\r\u001b[8C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[8C\u001b[?25h"] | ||
[20.355163, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\u001b[6C\u001b[K\u001b[0;31mexi\u001b[0;m\r\u001b[9C\u001b[?25h\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[9C\u001b[?25h"] | ||
[20.416389, "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"] | ||
[20.416482, "o", "\u001b[?25l\u001b[2A\r\r\n\r\n\r\u001b[10C\u001b[?25h"] | ||
[20.548625, "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
# ActionCallback | ||
[`ActionCallback`](https://pkg.go.dev/github.com/rsteube/carapace#ActionCallback) is a special action where the program itself provides the completion dynamically. For this the [hidden subcommand](../gen/hiddenSubcommand.md) is called with the current command line content which then lets cobra parse existing flags and invokes the callback function after that. | ||
|
||
[`ActionCallback`] completes values with given function. | ||
It is invoked after the arguments are parsed which enables contextual completion (e.g. based on flag values being set). | ||
|
||
> All [DefaultActions] are implicitly wrapped as [`ActionCallback`] for performance. | ||
```go | ||
carapace.ActionCallback(func(c carapace.Context) carapace.Action { | ||
if conditionCmd.Flag("required").Value.String() == "valid" { | ||
return carapace.ActionValues("condition fulfilled") | ||
} else { | ||
return carapace.ActionMessage("flag --required must be set to valid: " + conditionCmd.Flag("required").Value.String()) | ||
} | ||
if flag := actionCmd.Flag("values"); flag.Changed { | ||
return carapace.ActionMessage("values flag is set to: '%v'", flag.Value.String()) | ||
} | ||
return carapace.ActionMessage("values flag is not set") | ||
}) | ||
``` | ||
|
||
- `c.CallbackValue` provides access to the current (partial) value of the flag or positional argument being completed | ||
- return [ActionValues](./actionValues.md) without arguments to silently skip completion | ||
- return [ActionMessage](./actionMessage.md) to provide an error message (e.g. failure during invocation of an external command) | ||
- `c.Args` provides access to the positional arguments of the current subcommand (excluding the one currently being completed) | ||
- [`IsCallback`](https://pkg.go.dev/github.com/rsteube/carapace#IsCallback) indicates if the current invocation of the program is a callback (useful to skip any lengthy init steps) | ||
|
||
![](./actionCallback.cast) | ||
|
||
|
||
[`ActionCallback`]:https://pkg.go.dev/github.com/rsteube/carapace#ActionCallback | ||
[DefaultActions]:../defaultActions.md |
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