add custom command for checking out a GitHub PR branch from a list

Torgny Bjers 2024-05-04 13:35:56 -04:00
parent d7fe5df589
commit a1f797f8e3

@ -116,6 +116,26 @@ customCommands:
loadingText: "checking out PR"
```
## List and Select GitHub PR for Checkout
```yml
customCommands:
- key: "v"
context: "localBranches"
loadingText: "Checking out GitHub Pull Request..."
command: "gh pr checkout {{.Form.PullRequestNumber}}"
prompts:
- type: "menuFromCommand"
title: "Which PR do you want to check out?"
key: "PullRequestNumber"
command: >-
gh pr list --json number,title,headRefName,updatedAt
--template '{{`{{range .}}{{printf "#%v: %s - %s (%s)" .number .title .headRefName (timeago .updatedAt)}}{{end}}`}}'
filter: '#(?P<number>[0-9]+): (?P<title>.+) - (?P<ref_name>[^ ]+).*'
valueFormat: '{{.number}}'
labelFormat: '{{"#" | black | bold}}{{.number | white | bold}} {{.title | yellow | bold}}{{" [" | black | bold}}{{.ref_name | green}}{{"]" | black | bold}}'
```
## Opening git mergetool
```yml