Browse Source

remove packages with -r

pull/8/head
DanielFGray 1 year ago
parent
commit
b73b98fc42
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      npmsearch

+ 8
- 0
npmsearch View File

@@ -64,6 +64,14 @@ fzf() {
command fzf --inline-info --ansi --reverse +s --no-hscroll "$@"
}

if [[ $1 = '-r' || $1 = '--remove' ]]; then
mapfile -t rm < <(
jq -r '{dependencies, devDependencies} | .[] | keys | .[]' package.json |
fzf -m --cycle -e --reverse)
(( ${#rm} > 0 )) && $(select_from 'yarn remove' 'npm uninstall') "${rm[@]}"
die
fi

printf 'searching...\r'
search=$(npm search --json "$*") || exit


Loading…
Cancel
Save