even smarter DSL

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2018-07-27 16:49:08 +03:00
parent c054744d48
commit 739c430e42
2 changed files with 16 additions and 3 deletions

View File

@ -93,6 +93,14 @@ mime() {
done done
} }
scheme() {
declare r handler=$1; shift
for s in "$@"; do
uri_handlers+=( "$handler" "^$s:" )
done
}
is_uri() [[ $1 =~ ^[a-zA-Z][a-zA-Z0-9\+\.\-]+:.+ ]] is_uri() [[ $1 =~ ^[a-zA-Z][a-zA-Z0-9\+\.\-]+:.+ ]]
main() { main() {

View File

@ -1,12 +1,17 @@
#!syntax bash #!syntax bash
# Configuration file for sx-open # Configuration file for sx-open
# Note that as sx-open checks the regexes in order, they should be placed in order from specific to less so. # Note that as sx-open checks the regexes in order, they should be placed in order from specific to less so.
# Format: type cmd regex
# Examples: # scheme <cmd> <scheme>[ <scheme> ...]
#scheme browser http https
#scheme steam steam
#uri browser '^https?:' # Or you can specify a regex for the entire uri:
# uri <cmd> <regex>[ <regex> ...]
#uri steam '^steam:' #uri steam '^steam:'
#uri browser '^(https?|ftp):'
# Mime types for filesystem targets:
# mime <cmd> <regex>[ <regex> ...]
#mime sxiv '^image/' #mime sxiv '^image/'
#mime libreoffice '^application/msword$' #mime libreoffice '^application/msword$'