Browse Source

npmsearch: --help info

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)
10 10
 colors[green]=$(tput setaf 2)
11 11
 colors[reset]=$(tput sgr0)
12 12
 
13
+usage() {
14
+  LESS=-FEXR less <<-HELP
15
+npmsearch [options] [packages]
16
+  searches npm for packages
17
+
18
+  -r, --remove
19
+    list and remove packages from package.json
20
+
21
+to increase the amount of packages shown when searching, try:
22
+  npm config set searchlimit 40
23
+
24
+HELP
25
+}
26
+
13 27
 color() {
14 28
   local color="$1"; shift
15 29
   printf '%s' "${colors[$color]}"
@@ -60,6 +74,11 @@ fzf() {
60 74
   command fzf --inline-info --ansi --reverse +s --no-hscroll "$@"
61 75
 }
62 76
 
77
+if [[ $1 = '-h' || $1 = '--help' ]]; then
78
+  usage
79
+  exit
80
+fi
81
+
63 82
 if [[ $1 = '-r' || $1 = '--remove' ]]; then
64 83
   mapfile -t rm < <(
65 84
     jq -r '{dependencies, devDependencies} | .[] | keys | .[]' package.json |

Loading…
Cancel
Save