Last active
May 13, 2020 08:50
-
-
Save hogashi/8469463b4d78e11f97c4433aace604ae to your computer and use it in GitHub Desktop.
ghq look with peco shorthand in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ghq look on ghq list | |
function glk() { | |
ARG_STR="$1" | |
PECO_RESULT=$(ghq list | peco --query "$ARG_STR") | |
PECO_RESULT=$(echo -n "${PECO_RESULT}" | tr -d '\n' | perl -pe 's/(^ | $)//g') | |
if [ ! -n "$PECO_RESULT" ]; then | |
return 1 | |
fi | |
pushd "${GHQ_ROOT}/${PECO_RESULT}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment