3 Commits
1.2 ... 1.3

Author SHA1 Message Date
fbt
303bdf5d71 that is also redundant 2014-11-26 16:00:03 +03:00
fbt
d8b9b5dc01 ^file:// is redundant 2014-11-26 15:59:17 +03:00
fbt
7696ea5ce8 ugh, making this work with mimes is annoying 2014-11-25 13:22:15 +03:00
2 changed files with 9 additions and 12 deletions

13
sx-open
View File

@@ -41,18 +41,15 @@ main() {
target="$1" target="$1"
[[ "$target" ]] || { usage; exit; } [[ "$target" ]] || { usage; exit; }
if [[ "$target" =~ ${cfg_uri_regex} ]]; then handle_uri "$target" || {
handle_uri "$target" [[ "$target" =~ file://.+ ]] && { target="${target##*file://}"; }
elif [[ -e "$target" ]]; then
[[ -e "$target" ]] && {
[[ "$target" =~ ^/.* ]] || { target="${PWD}/${target}"; } [[ "$target" =~ ^/.* ]] || { target="${PWD}/${target}"; }
handle_uri "file://${target}" || {
handle_mime "$target" handle_mime "$target"
} }
else }
echo "$target is not a uri nor is it an existing file. Bailing."
return 1
fi
[[ "$?" -gt 0 ]] && { echo "No handlers found for $target"; } [[ "$?" -gt 0 ]] && { echo "No handlers found for $target"; }

View File

@@ -3,8 +3,8 @@
uri_handlers=( uri_handlers=(
["steam"]='^steam://.+' ["steam"]='^steam://.+'
["browser"]='.+' ["javaws"]='kvm.+?\.cgi$'
["javaws"]='^file:///.+?kvm.+?\.cgi$' ["browser"]='^http(s)://.+'
) )
mime_handlers=( mime_handlers=(