mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 12:58:21 +08:00
[Refactor] nvm_alias: one-pass trailing whitespace strip
Replace the per-character trailing-whitespace loop with a one-pass parameter expansion, per review.
This commit is contained in:
@@ -1377,12 +1377,7 @@ nvm_alias() {
|
|||||||
*[![:space:]]*) ;;
|
*[![:space:]]*) ;;
|
||||||
*) continue ;;
|
*) continue ;;
|
||||||
esac
|
esac
|
||||||
while : ; do
|
NVM_ALIAS_LINE="${NVM_ALIAS_LINE%"${NVM_ALIAS_LINE##*[![:space:]]}"}"
|
||||||
case "${NVM_ALIAS_LINE}" in
|
|
||||||
*[[:space:]]) NVM_ALIAS_LINE="${NVM_ALIAS_LINE%[[:space:]]}" ;;
|
|
||||||
*) break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
nvm_echo "${NVM_ALIAS_LINE}"
|
nvm_echo "${NVM_ALIAS_LINE}"
|
||||||
done < "${NVM_ALIAS_PATH}"
|
done < "${NVM_ALIAS_PATH}"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user