Browse Source

npmsearch: header info

pull/7/head
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
printf "formatting...\r"
search=$(jq -r '.[] | "\(.name)|\(.version)|\(.description)"' <<< "$search" | column -t -s'|')

if has jq; then
preview='npm view --json {1} | jq -C "del(.users, .time, .versions)"'
else
preview='npm view {1}'
fi

mapfile -t packages < <(fzf --multi --ansi --reverse \
mapfile -t packages < <(fzf --inline-info --multi --ansi --reverse \
--bind='Ctrl-X:toggle-preview' \
--expect='Ctrl-d,enter' \
--preview-window='hidden:down' \
--preview="$preview" \
--header='enter to save, Ctrl-D saves as dev-dependency, Ctrl-X for extra info' \
--preview='npm view --json {1} | jq -C "del(.users, .time, .versions)"' \
--header='enter to save, Ctrl-D saves as dev-dependency, Ctrl-X for extra info, tab to select multiple' \
<<< "$search" || exit 1)

key="${packages[0]}"

Loading…
Cancel
Save