Skip to content

Instantly share code, notes, and snippets.

@azu
Created January 20, 2023 11:35
Show Gist options
  • Save azu/e0cf3b7260c1be06dc161cdbeb94d6fc to your computer and use it in GitHub Desktop.
Save azu/e0cf3b7260c1be06dc161cdbeb94d6fc to your computer and use it in GitHub Desktop.
search GitHub Isssue and checkout for develop
function gh-issue-checkout(){
INITIAL_QUERY="$1"
GH_ISSUE_LIST="gh issue list -S"
FZF_DEFAULT_COMMAND="$GH_ISSUE_LIST '$INITIAL_QUERY'" \
gh issue list | \
fzf --layout=reverse \
--bind "change:reload:$GH_ISSUE_LIST {q} || true,ctrl-o:execute(echo {} | xargs gh issue view --web)+abort"\
--preview "gh issue view {1} | bat --color=always --style=grid --file-name O.md" \
--header 'Press Ctrl+O to open issue' \
| awk '{print $1}' | xargs -IXXX gh issue develop XXX --name "feature/XXX" --checkout
}
zle -N gh-issue-checkout
bindkey '^B^I' gh-issue-checkout
@azu
Copy link
Author

azu commented Jan 20, 2023

gh-issue-devlop.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment