Skip to content

Instantly share code, notes, and snippets.

@peccu
Last active August 29, 2015 14:27
Show Gist options
  • Save peccu/0420faf88d447ce067f2 to your computer and use it in GitHub Desktop.
Save peccu/0420faf88d447ce067f2 to your computer and use it in GitHub Desktop.
View Docset in terminal(Concept version)
#!/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)"
}
@peccu
Copy link
Author

peccu commented Aug 20, 2015

  • collect DocSetPlatformFamily from each Info.plist
  • support {keyword}:{query}
  • untar tarix.tgx

DocSet for Dash.app only. xcode docset is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment