Skip to content

Commit

Permalink
feat(run): view logs via enter keybind if completed
Browse files Browse the repository at this point in the history
The `run` command's `enter` keybinding will now display logs if the run
is completed. The keybinding will still watch for status updates if the
run is in progress.

The `alt-l` keybinding is deprecated in favor of `enter` and will be
removed in v1.
  • Loading branch information
benelan committed Jun 20, 2024
1 parent bdd80f9 commit b15f6a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ that can be used with any `gh fzf` command:
- **Aliases**: `r`, `runs`, `-r`, `--run`, `--runs`
- **Flags**: See `gh run list --help` for available options
- **Keybindings**:
- `enter`: Watch for status updates on the selected run
(see `gh run watch --help`)
- `alt-l`: Display logs for the selected run (see `gh run view --help`)
- `enter`: Watch for status changes or view logs, depending on whether the
selected run is in progress or completed.
(see `gh run watch --help` and `gh run view --help`)
- `alt-l`: Display logs for the selected run (**deprecated**, use `enter` instead)
- `alt-d`: Download artifacts from the selected run
(see `gh run download --help`)
- `alt-r`: Rerun the selected run (see `gh run rerun --help`)
Expand Down
10 changes: 8 additions & 2 deletions gh-fzf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# vim:foldmethod=marker:
# shellcheck disable=2086,2015,2016
set -e

Expand Down Expand Up @@ -373,7 +374,7 @@ run_cmd() {
'\'''

# keybinding hints {{{2
run_header="Actions > (enter: watch) (alt-l: logs) (alt-r: rerun) (alt-R: rerun failed) (alt-x: cancel) (alt-n: notify) (alt-p: pr) (alt-d: download)
run_header="Actions > (enter: watch/logs) (alt-r: rerun) (alt-R: rerun failed) (alt-x: cancel) (alt-n: notify) (alt-p: pr) (alt-d: download)
Filters > (alt-f: failed) (alt-i: in_progress) (alt-b: current branch) (alt-u: current user)
$global_binds
Expand All @@ -387,7 +388,12 @@ $global_binds
--bind="start:$on_start" \
--bind="ctrl-o:execute-silent(gh run view --web {-1} $repo_flag &)+refresh-preview" \
--bind="ctrl-y:execute-silent(gh fzf util copy-url run {-1})+refresh-preview" \
--bind="enter:execute(gh run watch {-1} $repo_flag)+refresh-preview" \
--bind="enter:execute(
case {1} in
in_progress | queued | requested | waiting) gh run watch {-1} $repo_flag ;;
*) gh run view --log {-1} $repo_flag ;;
esac
)+refresh-preview" \
--bind="alt-l:execute(gh run view --log {-1} $repo_flag)+refresh-preview" \
--bind="alt-r:execute(gh run rerun {-1} $repo_flag)+refresh-preview" \
--bind="alt-R:execute(gh run rerun --failed {-1} $repo_flag)+refresh-preview" \
Expand Down

0 comments on commit b15f6a9

Please sign in to comment.