mirror of
https://github.com/tj/n.git
synced 2024-11-25 07:39:21 +01:00
Added n ls|list
to show versions available
This commit is contained in:
parent
6c952abcd1
commit
b890a96024
12
bin/n
12
bin/n
@ -241,6 +241,17 @@ display_latest_version() {
|
||||
| tail -n1
|
||||
}
|
||||
|
||||
#
|
||||
# Display the versions of node available.
|
||||
#
|
||||
|
||||
list_versions() {
|
||||
$GET 2> /dev/null http://nodejs.org/dist/ \
|
||||
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
|
||||
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
||||
| awk '{ print " " $1 }'
|
||||
}
|
||||
|
||||
# Handle arguments
|
||||
|
||||
if test $# -eq 0; then
|
||||
@ -255,6 +266,7 @@ else
|
||||
as|use) execute_with_version ${@:2}; exit ;;
|
||||
rm|-) remove_version ${@:2}; exit ;;
|
||||
latest) install_node `n --latest`; exit ;;
|
||||
ls|list) list_versions ${@:2}; exit ;;
|
||||
*) install_node $@; exit ;;
|
||||
esac
|
||||
shift
|
||||
|
Loading…
Reference in New Issue
Block a user