diff options
author | Elwardi <elwardifadeli@gmail.com> | 2021-07-19 11:46:29 +0100 |
---|---|---|
committer | Elwardi <elwardifadeli@gmail.com> | 2021-07-19 11:46:29 +0100 |
commit | f1ced5539a9a53ea5c8e501243377d3c74cef2d5 (patch) | |
tree | bc790f78def75b8afa40a8274d30007b05444d30 /docs | |
parent | 77e9ee64a45bbee3f0e2367a8670b2e7d6a59c6f (diff) |
Add option to format filter matches to menuFromCommand prompts
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Custom_Command_Keybindings.md | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/Custom_Command_Keybindings.md b/docs/Custom_Command_Keybindings.md index 7a9f1bc0d..77fb90be5 100644 --- a/docs/Custom_Command_Keybindings.md +++ b/docs/Custom_Command_Keybindings.md @@ -46,7 +46,8 @@ customCommands: - type: 'menuFromCommand' title: 'Remote branch:' command: 'git branch -r --list {{index .PromptResponses 0}}/*' - filter: '.*{{index .PromptResponses 0}}/(.*)' + filter: '.*{{index .PromptResponses 0}}/(?P<branch>.*)' + format: '{{ .branch }}' ``` Looking at the command assigned to the 'n' key, here's what the result looks like: @@ -99,8 +100,11 @@ The permitted prompt fields are: | options | (only applicable to 'menu' prompts) the options to display in the menu | no | | command | (only applicable to 'menuFromCommand' prompts) the command to run to generate | yes | | | menu options | | -| filter | (only applicable to 'menuFromCommand' prompts) the regexp to run specify groups | yes | -| | which are going to be kept from the command's output | | +| filter | (only applicable to 'menuFromCommand' prompts) the regexp to run specifying | yes | +| | groups which are going to be kept from the command's output | | +| format | (only applicable to 'menuFromCommand' prompts) how to format matched groups from | yes | +| | the filter. You can use named groups, or `{{ .group_GROUPID_MATCHID }}`. | yes | +| | PS: named groups keep last non-empty match | yes | The permitted option fields are: | _field_ | _description_ | _required_ | |