diff options
author | Michael Mead <mmead.developer@gmail.com> | 2022-06-24 22:37:10 -0700 |
---|---|---|
committer | Michael Mead <mmead.developer@gmail.com> | 2022-07-04 11:36:13 -0700 |
commit | 9d304098bb91336f621fefdef53a645b22dbb9d5 (patch) | |
tree | 0cf131bab84d7de474724356f1f858c0c6de4eaf /docs/Custom_Command_Keybindings.md | |
parent | 582b1991a47fc53436ee20ac52479cd48004a56d (diff) |
feat: add confirm prompt for custom keybindings
- Supports configuring a custom confirmation prompt via `config.yml` for
custom keybindings. A new `CustomCommandPrompt.Body` field is
used to store the immutable body text of the confirmation popup.
- Adds a sample 'confirm' prompt to the example `config.yml`.
- Updates the `Prompts` section of the documentation to include
'confirm' prompt type and also describe which fields pertain to it
(i.e. `initialValue`).
Closes: https://github.com/jesseduffield/lazygit/issues/1858
Signed-off-by: Michael Mead <mmead.developer@gmail.com>
Diffstat (limited to 'docs/Custom_Command_Keybindings.md')
-rw-r--r-- | docs/Custom_Command_Keybindings.md | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/docs/Custom_Command_Keybindings.md b/docs/Custom_Command_Keybindings.md index 0b677fa48..47b9d8f97 100644 --- a/docs/Custom_Command_Keybindings.md +++ b/docs/Custom_Command_Keybindings.md @@ -49,6 +49,13 @@ customCommands: filter: '.*{{index .PromptResponses 0}}/(?P<branch>.*)' valueFormat: '{{ .branch }}' labelFormat: '{{ .branch | green }}' + - key: '<f1>' + command: 'git reset --soft {{.CheckedOutBranch.UpstreamRemote}}' + context: 'files' + prompts: + - type: 'confirm' + title: "Confirm:" + body: "Are you sure you want to reset HEAD to {{.CheckedOutBranch.UpstreamRemote}}?" ``` Looking at the command assigned to the 'n' key, here's what the result looks like: @@ -94,14 +101,15 @@ The permitted contexts are: The permitted prompt fields are: -| _field_ | _description_ | _required_ | -| ------------ | -------------------------------------------------------------------------------- | ---------- | -| type | one of 'input' or 'menu' | yes | -| title | the title to display in the popup panel | no | -| initialValue | (only applicable to 'input' prompts) the initial value to appear in the text box | no | -| 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 | | +| _field_ | _description_ | _required_ | +| ------------ | -----------------------------------------------------------------------------------------------| ---------- | +| type | one of 'input', 'menu', or 'confirm' | yes | +| title | the title to display in the popup panel | no | +| initialValue | (only applicable to 'input' prompts) the initial value to appear in the text box | no | +| body | (only applicable to 'confirm' prompts) the immutable body text to appear in the text box | no | +| 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 specifying groups which are going to be kept from the command's output | yes | | valueFormat | (only applicable to 'menuFromCommand' prompts) how to format matched groups from the filter to construct a menu item's value (What gets appended to prompt responses when the item is selected). You can use named groups, or `{{ .group_GROUPID }}`. PS: named groups keep first match only | yes | | labelFormat | (only applicable to 'menuFromCommand' prompts) how to format matched groups from the filter to construct the item's label (What's shown on screen). You can use named groups, or `{{ .group_GROUPID }}`. You can also color each match with `{{ .group_GROUPID \| colorname }}` (Color names from [here](https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md)). If `labelFormat` is not specified, `valueFormat` is shown instead. PS: named groups keep first match only | no | |