Skip to content

Commit

Permalink
GH-15: search extra docsets in $DASHT_DOCSETS_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Oct 23, 2016
1 parent 3d535ca commit fe48577
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bin/dasht-query-line
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
# If undefined, its value is assumed to be `$XDG_DATA_HOME/dasht/docsets/`
# or, if `XDG_DATA_HOME` is undefined, `$HOME/.local/share/dasht/docsets/`.
#
# `DASHT_DOCSETS_PATH`
# Defines additional filesystem locations where [Dash] docsets may be found.
# These locations are _not recursively_ searched and they must be delimited
# by one or more colon `:` characters, like the `PATH` environment variable.
#
# ## EXIT STATUS
#
# 44
Expand All @@ -94,8 +99,13 @@ test $# -gt 0 && shift # shift off PATTERN so argv contains solely DOCSETs
status=44 # (default) exit with a nonzero status when no results are found
trap 'status=0' USR1 # override default exit status when results are found

dasht-docsets "$@" | while read -r docset; do
database="$DASHT_DOCSETS_DIR/$docset".docset/Contents/Resources/docSet.dsidx
echo "$DASHT_DOCSETS_DIR:$DASHT_DOCSETS_PATH" | tr -s : '\n' |
while read -r dirname; do ls -d "$dirname"/*.docset 2>/dev/null || :; done |
while read -r pathname; do
docset=$(basename "$pathname" .docset)
echo "$docset" | grep -E -i -q "$(IFS='|'; echo "$*")" || continue

database="$pathname"/Contents/Resources/docSet.dsidx
file_url="file://$(dirname "$database")/Documents/"

dasht-query-exec "$pattern" "$database" -line |
Expand Down

0 comments on commit fe48577

Please sign in to comment.