Browse Source

npmsearch: --help info

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

+ 19
- 0
npmsearch View File

@@ -10,6 +10,20 @@ colors[red]=$(tput setaf 1)
colors[green]=$(tput setaf 2)
colors[reset]=$(tput sgr0)

usage() {
LESS=-FEXR less <<-HELP
npmsearch [options] [packages]
searches npm for packages

-r, --remove
list and remove packages from package.json

to increase the amount of packages shown when searching, try:
npm config set searchlimit 40

HELP
}

color() {
local color="$1"; shift
printf '%s' "${colors[$color]}"
@@ -60,6 +74,11 @@ fzf() {
command fzf --inline-info --ansi --reverse +s --no-hscroll "$@"
}

if [[ $1 = '-h' || $1 = '--help' ]]; then
usage
exit
fi

if [[ $1 = '-r' || $1 = '--remove' ]]; then
mapfile -t rm < <(
jq -r '{dependencies, devDependencies} | .[] | keys | .[]' package.json |

Loading…
Cancel
Save