Fish: Query Dash.app from fish shell
# Open Dash.app and query for the defined term.
# Optionally search with a specific docset.
#
# Format:
# open dash://php:{query}
#
# Requires getopts function
function dash -d 'Opens Dash.app using query term'
if [ (count $argv) -lt 1 ]
open '/Applications/Dash.app'
return 0
end
set query ""
set docset ""
getopts $argv | while read -l key option
switch $key
case _
set query $option
case d docset
set docset $option
end
end
if [ "$query" != "" ]; and [ "$docset" != "" ]
open dash://$docset:{$query}
else if [ "$query" != "" ]
open dash://{$query}
end
end