Last active
September 27, 2018 05:42
-
-
Save MaxMEllon/0bcb8ec3d3f33ac53f637ddff72cd587 to your computer and use it in GitHub Desktop.
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
npm-remove-interactive() | |
{ | |
local k results | |
while out=$( | |
cat package.json \ | |
| jq '.devDependencies * .dependencies | keys[]' \ | |
| fzf --ansi --multi --no-sort --reverse --query="$q" \ | |
--print-query --expect=ctrl-d); do | |
q=$(head -1 <<< "$out") | |
k=$(head -2 <<< "$out" | tail -1) | |
out=("${(@f)$(printf $out)}") | |
[ -z "$out" ] && continue | |
if [ "$k" = ctrl-d ]; then | |
for p in $out; do | |
npm remove $p | |
done | |
break | |
fi | |
done | |
} |
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
yarn-remove-interactive() | |
{ | |
local k results | |
while out=$( | |
cat package.json \ | |
| jq '.devDependencies * .dependencies | keys[]' \ | |
| fzf --ansi --multi --no-sort --reverse --query="$q" \ | |
--print-query --expect=ctrl-d); do | |
q=$(head -1 <<< "$out") | |
k=$(head -2 <<< "$out" | tail -1) | |
out=("${(@f)$(printf $out)}") | |
[ -z "$out" ] && continue | |
if [ "$k" = ctrl-d ]; then | |
for p in $out; do | |
yarn remove $p | |
done | |
break | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment