Last active
July 29, 2020 13:27
-
-
Save kopiro/83419bdd24ec1107e81f5095c3035bc2 to your computer and use it in GitHub Desktop.
Yarn run fuzzy matching
This file contains hidden or 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
pkgj-run-list() { | |
jq .scripts package.json | grep -o '.*\":' | sed -nE 's/\"(.*)\":/\1/p' | awk '{$1=$1};1' | fzf | tr -d '\r' | tr -d '\n' | |
} | |
yarn-x() { | |
PKG_CMD=$(pkgj-run-list) | |
[ -n "$PKG_CMD" ] && print -s "yarn $PKG_CMD" && yarn "$PKG_CMD" | |
} | |
alias yx="yarn-x" | |
npm-x() { | |
PKG_CMD=$(pkgj-run-list) | |
[ -n "$PKG_CMD" ] && print -s "npm run $PKG_CMD" && npm run "$PKG_CMD" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://asciinema.org/a/Vr3WIet57DFD2L02q1Xdn8AlR