34 lines
794 B
Bash
Executable File
34 lines
794 B
Bash
Executable File
#!/bin/bash
|
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
|
|
|
function display_help() {
|
|
uecho "$scriptname: Ouvrir une URL dans un navigateur
|
|
|
|
USAGE
|
|
$scriptname <file.url|file.desktop|URL>"
|
|
}
|
|
|
|
source "$(dirname "$0")/ulib/ulib" &&
|
|
urequire DEFAULTS ||
|
|
exit 1
|
|
|
|
parse_opts "${PRETTYOPTS[@]}" \
|
|
--help '$exit_with display_help' \
|
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
|
|
|
url="$("$scriptdir/caturl" "$1")" || die
|
|
|
|
if progexists xdg-open; then
|
|
exec xdg-open "$url"
|
|
elif progexists gnome-open; then
|
|
exec gnome-open "$url"
|
|
else
|
|
# si on est sur un MacOSX, essayer utiliser open
|
|
urequire sysinfos
|
|
if check_sysinfos -s macosx; then
|
|
exec open "$url"
|
|
fi
|
|
fi
|
|
|
|
die "Impossible de trouver une méthode pour ouvrir l'url $url"
|