-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-nvm.sh
More file actions
executable file
·44 lines (32 loc) · 827 Bytes
/
install-nvm.sh
File metadata and controls
executable file
·44 lines (32 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# --- External Functions ---
# Load the notify function
source lib/notify_lib.sh
DEFAULT_NVM_VERSION="0.40.1"
show_help() {
cat <<EOF
NVM Manager
Usage:
$0 -i [version] # Install (default $DEFAULT_NVM_VERSION)
$0 -u # Complete uninstall
$0 -h # Show help
EOF
}
install() {
version="${1:-$DEFAULT_NVM_VERSION}"
notify "Installing NVM version $version..."
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/v$version/install.sh" | bash
notify "Installation complete. NVM $(nvm --version) installed." "success"
}
uninstall() {
# Remove NVM directory
rm -rf "${NVM_DIR:-$HOME/.nvm}"
notify "NVM completely uninstalled" "success"
}
# --- Main Logic ---
case "$1" in
-i) install "$2" ;;
-u) uninstall ;;
-h) show_help ;;
*) show_help; exit 1 ;;
esac