Browse Source

npmsearch: header info

DanielFGray 2 years ago
parent
commit
1a075b66a6
1 changed files with 3 additions and 9 deletions
  1. 3
    9
      npmsearch

+ 3
- 9
npmsearch View File

@@ -53,18 +53,12 @@ search=$(npm search --json "$*") || exit
53 53
 printf "formatting...\r"
54 54
 search=$(jq -r '.[] | "\(.name)|\(.version)|\(.description)"' <<< "$search" | column -t -s'|')
55 55
 
56
-if has jq; then
57
-  preview='npm view --json {1} | jq -C "del(.users, .time, .versions)"'
58
-else
59
-  preview='npm view {1}'
60
-fi
61
-
62
-mapfile -t packages < <(fzf --multi --ansi --reverse \
56
+mapfile -t packages < <(fzf --inline-info --multi --ansi --reverse \
63 57
   --bind='Ctrl-X:toggle-preview' \
64 58
   --expect='Ctrl-d,enter' \
65 59
   --preview-window='hidden:down' \
66
-  --preview="$preview" \
67
-  --header='enter to save, Ctrl-D saves as dev-dependency, Ctrl-X for extra info' \
60
+  --preview='npm view --json {1} | jq -C "del(.users, .time, .versions)"' \
61
+  --header='enter to save, Ctrl-D saves as dev-dependency, Ctrl-X for extra info, tab to select multiple' \
68 62
   <<< "$search" || exit 1)
69 63
 
70 64
 key="${packages[0]}"

Loading…
Cancel
Save