[Refactor] Reduce one more `sed` & pipe to speedup

Peter Dave Hello 2017-03-28 23:15:35 +08:00 committed by Jordan Harband
parent 6534568745
commit e367533eb8
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 2 additions and 2 deletions

4
nvm.sh
View File

@ -1083,9 +1083,9 @@ nvm_ls() {
\\#${SEARCH_PATTERN}# !d;
" \
-e 's#^\([^/]\{1,\}\)/\(.*\)$#\2.\1#;' \
-e 's#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#;' \
-e "s#^${NVM_NODE_PREFIX}-##;" \
| command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n \
| command sed -e 's#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#;' \
-e "s#^${NVM_NODE_PREFIX}-##;" \
)"
fi
fi