LoginSignup
0
0

More than 3 years have passed since last update.

ghq の v1 でなくなった look コマンドをデフォルメして復活させる(zsh版)

Last updated at Posted at 2020-09-06

TL,DR

ghq の v1 でなくなった look コマンドをデフォルメして復活させる の zsh 版+αです

変更点

  • command cd だと動かなかったので cd
  • ghqcommand ghq
  • 部分一致した上で peco を起動できるように

Code

ghq() {
    if [[ $1 == "look" ]]; then
        if [[ -n $2 ]]; then
            repo_name="$2"
            exact_matched=$(command ghq list --full-path --exact "$repo_name")
            if [[ -n "$exact_matched" ]]; then
                cd "$exact_matched"
            else
                cd $(command ghq list --full-path "$repo_name" | peco)
            fi
        else
            cd $(command ghq list --full-path | peco)
        fi
    else
        command ghq "$@"
    fi
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0