You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clean up the configuration of where a custom command's output goes (#4525)
- **PR Description**
Previously, custom commands had a `stream` field that was overloaded
with two meanings: 1) it made the command's output appear in the log
view, and 2) it used a pty for running the command. It makes sense to be
able to configure these independently, so add a separate `pty` field
(although that's probably rarely needed in practice).
Also, the `stream` and `showOutput` fields were conflicting; they could
be used together, but when setting them both to true, the popup would
always show "empty output", so this doesn't make sense. Combine them
both into a single `output` property with the possible values "none",
"log", or "popup".
We still have some more redundancy here, for example pty is only used
when output is set to "log", and neither output nor pty are used when
subprocess is true. But I stopped there, because I think this is already
an improvement over the previous state.
- **Please check if the PR fulfills these requirements**
* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [x] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [ ] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [x] If a new UserConfig entry was added, make sure it can be
hot-reloaded (see
[here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig))
* [x] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
Copy file name to clipboardExpand all lines: docs/Custom_Command_Keybindings.md
+4-6
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ customCommands:
14
14
- key: 'C'
15
15
context: 'global'
16
16
command: "git commit"
17
-
subprocess: true
17
+
output: terminal
18
18
- key: 'n'
19
19
context: 'localBranches'
20
20
prompts:
@@ -53,13 +53,11 @@ For a given custom command, here are the allowed fields:
53
53
| key | The key to trigger the command. Use a single letter or one of the values from [here](https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md). Custom commands without a key specified can be triggered by selecting them from the keybindings (`?`) menu | no |
54
54
| command | The command to run (using Go template syntax for placeholder values) | yes |
55
55
| context | The context in which to listen for the key (see [below](#contexts)) | yes |
56
-
| subprocess | Whether you want the command to run in a subprocess (e.g. if the command requires user input) | no |
57
56
| prompts | A list of prompts that will request user input before running the final command | no |
58
57
| loadingText | Text to display while waiting for command to finish | no |
59
58
| description | Label for the custom command when displayed in the keybindings menu | no |
60
-
| stream | Whether you want to stream the command's output to the Command Log panel | no |
61
-
| showOutput | Whether you want to show the command's output in a popup within Lazygit | no |
62
-
| outputTitle | The title to display in the popup panel if showOutput is true. If left unset, the command will be used as the title. | no |
59
+
| output | Where the output of the command should go. 'none' discards it, 'terminal' suspends lazygit and runs the command in the terminal (useful for commands that require user input), 'log' streams it to the command log, 'logWithPty' is like 'log' but runs the command in a pseudo terminal (can be useful for commands that produce colored output when the output is a terminal), and 'popup' shows it in a popup. | no |
60
+
| outputTitle | The title to display in the popup panel if output is set to 'popup'. If left unset, the command will be used as the title. | no |
63
61
| after | Actions to take after the command has completed | no |
64
62
65
63
Here are the options for the `after` key:
@@ -365,7 +363,7 @@ If you use the commandMenu property, none of the other properties except key and
365
363
366
364
## Debugging
367
365
368
-
If you want to verify that your command actually does what you expect, you can wrap it in an 'echo' call and set `showOutput: true` so that it doesn't actually execute the command but you can see how the placeholders were resolved.
366
+
If you want to verify that your command actually does what you expect, you can wrap it in an 'echo' call and set `output: popup` so that it doesn't actually execute the command but you can see how the placeholders were resolved.
0 commit comments