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 5e8e43b
Show file tree
Hide file tree
Showing 2 changed files with 17 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
5 changes: 5 additions & 0 deletions man/man1/dasht-query-line.1
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ url = file:///home/sunny/.local/share/dasht/docsets/Bash.docset/Contents/Resourc
Defines the filesystem location where your Dash \[la]https://kapeli.com/dash\[ra] docsets are installed.
If undefined, its value is assumed to be \fB\fC$XDG_DATA_HOME/dasht/docsets/\fR
or, if \fB\fCXDG_DATA_HOME\fR is undefined, \fB\fC$HOME/.local/share/dasht/docsets/\fR\&.
.TP
\fB\fCDASHT_DOCSETS_PATH\fR
Defines additional filesystem locations where Dash \[la]https://kapeli.com/dash\[ra] docsets may be found.
These locations are \fInot recursively\fP searched and they must be delimited
by one or more colon \fB\fC:\fR characters, like the \fB\fCPATH\fR environment variable.
.SH EXIT STATUS
.TP
44
Expand Down

0 comments on commit 5e8e43b

Please sign in to comment.