Add error checking to nvm_tree_contains_path
This commit is contained in:
1 parent
6e6c5c4e2a
commit
5c7f08843d
2 files changed
+11
No files matched your search
@@ -58,6 +58,12 @@ nvm_tree_contains_path() {
|
||||
tree="$1"
|
||||
local node_path
|
||||
node_path="$2"
|
||||
|
||||
if [ "@$tree@" = "@@" ] || [ "@$node_path@" = "@@" ]; then
|
||||
>&2 echo "both the tree and the node path are required"
|
||||
return 2
|
||||
fi
|
||||
|
||||
local pathdir
|
||||
pathdir=$(dirname "$node_path")
|
||||
while [ "$pathdir" != "" ] && [ "$pathdir" != "." ] && [ "$pathdir" != "/" ] && [ "$pathdir" != "$tree" ]; do
|
||||
|
||||
Reference in new issue
Block a user