7 Commits
1.4 ... 1.4.1

Author SHA1 Message Date
fbt
6afb99d1ce filetype detection fix 2015-07-19 21:51:22 +03:00
fbt
0deb0b449c printf 2015-03-10 01:29:49 +03:00
fbt
597c801bdf Merge branch 'master' of builder:git/sx-open 2015-02-25 08:00:57 +03:00
fbt
0347154d6b wut 2015-02-25 08:00:47 +03:00
fbt
2470681dcb conflict 2015-02-19 14:03:49 +03:00
fbt
6cb89f0cd6 Code cleanup, thx to http://www.shellcheck.net 2015-01-17 16:38:52 +03:00
fbt
303bdf5d71 that is also redundant 2014-11-26 16:00:03 +03:00
2 changed files with 4 additions and 5 deletions

View File

@@ -3,10 +3,9 @@
# Source the config file. # Source the config file.
cfg_file="$HOME/.config/sx-open.cfg" cfg_file="$HOME/.config/sx-open.cfg"
cfg_uri_regex='^[A-Za-z]([A-Za-z0-9+.-]+)?://.+'
[[ -f "$cfg_file" ]] && { source "$cfg_file"; } [[ -f "$cfg_file" ]] && { source "$cfg_file"; }
usage() { echo "${0##*/} <uri/file>"; } usage() { printf '%s <uri/file>\n' "${0##*/}"; }
handle_uri() { handle_uri() {
local target="$1" local target="$1"
@@ -24,7 +23,7 @@ handle_uri() {
} }
handle_mime() { handle_mime() {
target_mimetype=$(file -ib "$target") IFS=';' read target_mimetype charset <<< $( file -ib "$target" )
for m in "${mime_handlers[@]}"; do for m in "${mime_handlers[@]}"; do
IFS='=' read cmd regex <<< "$m" IFS='=' read cmd regex <<< "$m"
@@ -52,7 +51,7 @@ main() {
} }
} }
[[ "$?" -gt 0 ]] && { echo "No handlers found for $target"; } [[ "$?" -gt 0 ]] && { printf "No handlers found for %s\n" "$target"; }
return 0 return 0
} }

View File

@@ -4,7 +4,7 @@
uri_handlers=( uri_handlers=(
'steam=^steam://.+' 'steam=^steam://.+'
'javaws=.+kvm.+?\.cgi$' 'javaws=.+kvm.+?\.cgi$'
'browser=^http(s)://.+' 'browser=^https?://.+'
) )
mime_handlers=( mime_handlers=(