Skip to content

Commit e185d99

Browse files
committed
docs: update readme lazygit example
1 parent a1180d2 commit e185d99

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,28 @@ customCommands:
149149
- name: 'Open CI/Actions'
150150
value: 'ci'
151151
# pass selected contexts to `git open`, prefer file, then remote branch, then local branch
152-
command: 'git open {{.Form.action}} {{if .SelectedFile}}{{.SelectedFile.Name | quote}}{{else if .SelectedRemoteBranch}}{{.SelectedRemoteBranch.Name | quote}}{{else if .SelectedLocalBranch}}{{.SelectedLocalBranch.Name | quote}}{{end}}'
152+
command: |
153+
ACTION={{.Form.action | quote}}
154+
FILE={{if .SelectedFile}}{{.SelectedFile.Name | quote}}{{end}}
155+
REMOTE_BRANCH={{if .SelectedRemoteBranch}}{{.SelectedRemoteBranch.Name | quote}}{{end}}
156+
LOCAL_BRANCH={{if .SelectedLocalBranch}}{{.SelectedLocalBranch.Name | quote}}{{end}}
157+
COMMIT={{if .SelectedCommit}}{{.SelectedCommit.Sha | quote}}{{end}}
158+
case "$ACTION" in
159+
branch) ARG="$REMOTE_BRANCH";;
160+
commit) ARG="$COMMIT";;
161+
file) ARG="$FILE";;
162+
pr)
163+
ARG="$LOCAL_BRANCH"
164+
if [[ -n "$REMOTE_BRANCH" ]]; then
165+
ARG=$ARG $REMOTE_BRANCH
166+
fi
167+
;;
168+
project) ARG="";;
169+
prs) ARG="";;
170+
ci) ARG="";;
171+
*) ARG="";;
172+
esac
173+
git open $ACTION $ARG
153174
loadingText: 'Opening...'
154175
```
155176

0 commit comments

Comments
 (0)