mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
nuxfs: Added docs & shorthands for error testing.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
parent
6ec235ce19
commit
91cb61527f
2 changed files with 102 additions and 8 deletions
|
|
@ -3,7 +3,7 @@
|
|||
link.entered() {
|
||||
nux.log debug "Testing '$abs_path' as link"
|
||||
if test ! -h "$abs_path"; then
|
||||
nuxfs.error "$rel_path" "is not symlink."
|
||||
.error "is not symlink."
|
||||
return
|
||||
fi
|
||||
local REAL_LINK=$(readlink "$abs_path")
|
||||
|
|
@ -13,26 +13,26 @@ link.entered() {
|
|||
local cdir=$(dirname "$abs_path")
|
||||
MAT_TARGET=$(realpath "$cdir/$target")
|
||||
if test "$MAT_REAL" = "$MAT_TARGET"; then
|
||||
nuxfs.warning "$rel_path" "is using different definition for target '$3'"
|
||||
.warning "is using different definition for target '$3'"
|
||||
else
|
||||
nuxfs.error "$rel_path" "links to $REAL_LINK instead of $target"
|
||||
.error "links to $REAL_LINK instead of $target"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if test ! -e "$abs_path"; then
|
||||
nuxfs.warning "$rel_path" "target '$NC_White$target$NC_No' does not exists."
|
||||
.warning "target '$NC_White$target$NC_No' does not exists."
|
||||
fi
|
||||
}
|
||||
|
||||
git.entered() {
|
||||
nux.log debug "Testing '$rel_path' as git repository"
|
||||
if test ! -e "$rel_path/.git"; then
|
||||
nuxfs.error "$rel_path" "is not git repository"
|
||||
.error "$rel_path" "is not git repository"
|
||||
return
|
||||
fi
|
||||
local remotes=$(grep "$origin" "$rel_path/.git/config" | wc -l)
|
||||
if [ $remotes -eq 0 ]; then
|
||||
nuxfs.error "$rel_path" "Does not refer git remote '$origin'"
|
||||
.error "$rel_path" "Does not refer git remote '$origin'"
|
||||
return;
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue