Last active
August 29, 2015 14:27
-
-
Save peccu/0420faf88d447ce067f2 to your computer and use it in GitHub Desktop.
View Docset in terminal(Concept version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function collect-docset(){ | |
local query delimiter sql docPath awkscript | |
# query keyword | |
query=$1 | |
# delimiter | |
delimiter=' <<===>> ' | |
# SQL for search document path | |
sql="select name || '$delimiter' || path from searchIndex where name like '%$query%'" | |
# path splitter | |
awkscript='BEGIN{FS="'$delimiter'"}{print $2}' | |
sqlite3 docSet.dsidx "$sql" | |
} | |
function search-docset(){ | |
docPath=$(collect-docset $1| percol | awk "$awkscript") | |
# echo $docPath | |
echo "file://$(pwd)/Documents/$docPath" | |
} | |
function w3m-docset(){ | |
w3m "$(search-docset $1)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DocSet for Dash.app only. xcode docset is not supported.