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

nuxfs: Added support for specifying path.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2016-11-28 16:13:21 +01:00
parent ff642e4222
commit fbf020f0d3
3 changed files with 31 additions and 10 deletions

View file

@ -2,18 +2,22 @@ function nuxfs.relative {
echo "$(nuxfs.dir.get)/$1"
}
function nuxfs.relative-to-pwd {
realpath -s "$1" --relative-to "$(realpath "$(pwd)")"
}
function nuxfs.error {
local filename=$1; shift;
local filename=$(nuxfs.relative-to-pwd "$1"); shift;
nux.echo.error "$filename"$NC_No: $*;
}
function nuxfs.warning {
local filename=$1; shift;
local filename=$(nuxfs.relative-to-pwd "$1"); shift;
nux.echo.warning "$filename"$NC_No: $*;
}
function nuxfs.info {
local filename=$1; shift;
local filename=$(nuxfs.relative-to-pwd "$1"); shift;
echo -e $NC_White"$filename"$NC_No: $*;
}
@ -36,7 +40,7 @@ function nuxfs.file.exists {
function nuxfs.closest {
cmd=$1;
cdir=$(pwd);
cdir=$2;
nux.log trace "Searching in: " $cdir;
until [ -e "$cdir/$1" -o "$cdir" == "/" ]; do
cdir=$(dirname "$cdir");