1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Introduced new libraries for mime, thumbnails, labels

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2017-07-15 12:10:44 +02:00
parent 0ab8c73e07
commit e173c4613c
4 changed files with 219 additions and 0 deletions

View file

@ -157,6 +157,14 @@ function nux.check.nuxenv.file {
[[ "$path" =~ "^$NUX_ENV_DIR" ]]
}
function nux.check.optional {
local function="$1"; shift;
if nux.check.function "$function" ; then
$function "$@"
fi
}
function nux.check.exec {
local binary=$1;
test -n "$(which "$binary")"
@ -183,6 +191,16 @@ function nux.exec.optional {
fi
}
function nux.exec.or {
local maybe="$1"; shift;
local to_exec="$1"; shift;
if nux.check.function "$maybe" ; then
to_exec=$maybe
fi
$to_exec "$@";
}
function nux.dirty.urlencode {
echo -n "$1" | sed "s/ /%20/g"
}