cosmetic
This commit is contained in:
parent
006964df45
commit
c8aee44c2a
|
@ -248,15 +248,18 @@ function ppath() {
|
||||||
echo "$path"
|
echo "$path"
|
||||||
}
|
}
|
||||||
function ppath2() {
|
function ppath2() {
|
||||||
# Comme ppath() mais afficher '.' comme '../$dirname'
|
# Comme ppath() mais afficher '.' comme '. ($dirname)' pour la joliesse
|
||||||
local path="$1" cwd="$2"
|
local path="$1" cwd="$2"
|
||||||
|
|
||||||
path="$(abspath "$path")" # essayer de normaliser le chemin
|
path="$(abspath "$path")" # essayer de normaliser le chemin
|
||||||
[ -n "$cwd" ] || cwd="$(pwd)"
|
[ -n "$cwd" ] || cwd="$(pwd)"
|
||||||
|
|
||||||
[ "$path" == "$cwd" ] && path="../$(basename -- "$path")"
|
if [ "$path" == "$cwd" ]; then
|
||||||
[ "$cwd" != "/" -a "$cwd" != "$HOME" ] && path="${path#$cwd/}"
|
path=". ($(basename -- "$path"))"
|
||||||
[ "${path#$HOME/}" != "$path" ] && path="~${path#$HOME}"
|
else
|
||||||
|
[ "$cwd" != "/" -a "$cwd" != "$HOME" ] && path="${path#$cwd/}"
|
||||||
|
[ "${path#$HOME/}" != "$path" ] && path="~${path#$HOME}"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$path"
|
echo "$path"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue