diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-05-29 22:52:16 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-05-29 22:52:16 +1000 |
commit | 1de876ed4d1e5f95b70e109c2f05f722ef88b46e (patch) | |
tree | 20d6334398688b7da5e9d623bc29cb4795498d20 /docs | |
parent | 036a1ea519885ae9962c0ba2d90f642874cabd89 (diff) |
Support using command output directly in menuFromCommand custom command prompt
The menuFromCommand option is a little complicated, so I'm adding an easy way to just use the command output directly,
where each line becomes a suggestion, as-is.
Now that we support suggestions in the input prompt, there's less of a need for menuFromCommand, but it probably still
serves some purpose.
In future I want to support this filter/valueFormat/labelFormat thing for suggestions too. I would like to think a little more
about the interface though: is using a regex like we currently do really the simplest approach?
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Custom_Command_Keybindings.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/Custom_Command_Keybindings.md b/docs/Custom_Command_Keybindings.md index d6e796c66..7565b9f3a 100644 --- a/docs/Custom_Command_Keybindings.md +++ b/docs/Custom_Command_Keybindings.md @@ -264,6 +264,20 @@ Here's an example using unnamed groups: labelFormat: '{{ .group_1 | green }}' ``` +Here's an example using a command but not specifying anything else: so each line from the command becomes the value and label of the menu items + +```yml + - key : 'a' + description: 'Checkout a remote branch as FETCH_HEAD' + command: "open {{.Form.File | quote}}" + context: 'global' + prompts: + - type: 'menuFromCommand' + title: 'File:' + key: 'File' + command: 'ls' +``` + ## Placeholder values Your commands can contain placeholder strings using Go's [template syntax](https://jan.newmarch.name/golang/template/chapter-template.html). The template syntax is pretty powerful, letting you do things like conditionals if you want, but for the most part you'll simply want to be accessing the fields on the following objects: |