nodeswitch 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +47 -45
- package/bin/nodeswitch +1 -1
- package/bin/nodeswitch.cmd +17 -0
- package/bin/nodeswitch.ps1 +76 -59
- package/bin/nodeswitch.sh +90 -70
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 alexsch01
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
# nodeswitch
|
|
2
|
-
|
|
3
|
-
Node version switcher for Microsoft Windows x64
|
|
4
|
-
|
|
5
|
-
https://github.com/alexsch01/nodeswitch
|
|
6
|
-
|
|
7
|
-
<br>
|
|
8
|
-
|
|
9
|
-
#### How To Install
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install -g nodeswitch
|
|
13
|
-
|
|
14
|
-
*****
|
|
15
|
-
Node versions installed by this tool are in the "C:\Users\YOUR_USERNAME\AppData\Roaming\nodeswitch" folder
|
|
16
|
-
*****
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
#### Examples
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
nodeswitch add 12.16.3
|
|
23
|
-
nodeswitch add 18.13.0
|
|
24
|
-
|
|
25
|
-
nodeswitch remove 12.16.3
|
|
26
|
-
nodeswitch remove 18.13.0
|
|
27
|
-
|
|
28
|
-
nodeswitch use 12.16.3
|
|
29
|
-
nodeswitch use 18.13.0
|
|
30
|
-
|
|
31
|
-
nodeswitch use default
|
|
32
|
-
|
|
33
|
-
nodeswitch list
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
# nodeswitch
|
|
2
|
+
|
|
3
|
+
Node version switcher for Microsoft Windows x64
|
|
4
|
+
|
|
5
|
+
https://github.com/alexsch01/nodeswitch
|
|
6
|
+
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
#### How To Install
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install -g nodeswitch
|
|
13
|
+
|
|
14
|
+
*****
|
|
15
|
+
Node versions installed by this tool are in the "C:\Users\YOUR_USERNAME\AppData\Roaming\nodeswitch" folder
|
|
16
|
+
*****
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Examples
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
nodeswitch add 12.16.3
|
|
23
|
+
nodeswitch add 18.13.0
|
|
24
|
+
|
|
25
|
+
nodeswitch remove 12.16.3
|
|
26
|
+
nodeswitch remove 18.13.0
|
|
27
|
+
|
|
28
|
+
nodeswitch use 12.16.3
|
|
29
|
+
nodeswitch use 18.13.0
|
|
30
|
+
|
|
31
|
+
nodeswitch use default
|
|
32
|
+
|
|
33
|
+
nodeswitch list
|
|
34
|
+
|
|
35
|
+
nodeswitch path
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### How To Uninstall
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
npm uninstall -g nodeswitch
|
|
42
|
+
|
|
43
|
+
*****
|
|
44
|
+
In the "C:\Users\YOUR_USERNAME\AppData\Roaming\npm" folder, delete 4 files: nodeswitch, nodeswitch.cmd, nodeswitch.ps1, and nodeswitch.sh
|
|
45
|
+
In the "C:\Users\YOUR_USERNAME\.bash_profile" file, remove the line [alias nodeswitch="source nodeswitch"]
|
|
46
|
+
*****
|
|
47
|
+
```
|
package/bin/nodeswitch
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(return 0 2>/dev/null) && source nodeswitch.sh "$@" || echo "You need to relaunch Git Bash in order to use nodeswitch"
|
|
1
|
+
(return 0 2>/dev/null) && source nodeswitch.sh "$@" || echo "You need to relaunch Git Bash in order to use nodeswitch"
|
package/bin/nodeswitch.cmd
CHANGED
|
@@ -33,7 +33,22 @@ if not "%1" == "" (
|
|
|
33
33
|
curl -f https://nodejs.org/download/release/v%2 > nul 2>&1
|
|
34
34
|
if %ERRORLEVEL% equ 0 (
|
|
35
35
|
curl -s -o %AppData%\nodeswitch\%2.zip https://nodejs.org/download/release/v%2/node-v%2-win-x64.zip > nul
|
|
36
|
+
|
|
37
|
+
if not %ERRORLEVEL% equ 0 (
|
|
38
|
+
del %AppData%\nodeswitch\%2.zip
|
|
39
|
+
echo Node version not created
|
|
40
|
+
exit
|
|
41
|
+
)
|
|
42
|
+
|
|
36
43
|
tar -xf %AppData%\nodeswitch\%2.zip -C %AppData%\nodeswitch
|
|
44
|
+
|
|
45
|
+
if not %ERRORLEVEL% equ 0 (
|
|
46
|
+
del %AppData%\nodeswitch\%2.zip
|
|
47
|
+
rd /s /q %AppData%\nodeswitch\node-v%2-win-x64
|
|
48
|
+
echo Node version not created
|
|
49
|
+
exit
|
|
50
|
+
)
|
|
51
|
+
|
|
37
52
|
del %AppData%\nodeswitch\%2.zip
|
|
38
53
|
move %AppData%\nodeswitch\node-v%2-win-x64 %AppData%\nodeswitch\%2 > nul
|
|
39
54
|
) else (
|
|
@@ -49,6 +64,8 @@ if not "%1" == "" (
|
|
|
49
64
|
) else (
|
|
50
65
|
if "%1" == "list" (
|
|
51
66
|
dir /b %AppData%\nodeswitch
|
|
67
|
+
) else if "%1" == "path" (
|
|
68
|
+
echo %AppData%\nodeswitch
|
|
52
69
|
) else (
|
|
53
70
|
echo Incorrect command
|
|
54
71
|
)
|
package/bin/nodeswitch.ps1
CHANGED
|
@@ -1,59 +1,76 @@
|
|
|
1
|
-
$nodeswitch1stParameter = $args[0]
|
|
2
|
-
$nodeswitch2ndParameter = $args[1]
|
|
3
|
-
|
|
4
|
-
if ( $nodeswitch1stParameter -ne $null ) {
|
|
5
|
-
if ( $nodeswitch2ndParameter -ne $null ) {
|
|
6
|
-
if ( $args[2] -ne $null ) {
|
|
7
|
-
echo "Incorrect command"
|
|
8
|
-
} else {
|
|
9
|
-
if ( $nodeswitch1stParameter -eq "remove" ) {
|
|
10
|
-
if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
|
|
11
|
-
Remove-Item -Recurse $env:AppData\nodeswitch\$nodeswitch2ndParameter
|
|
12
|
-
} else {
|
|
13
|
-
echo "Node version not installed"
|
|
14
|
-
}
|
|
15
|
-
} elseif ( $nodeswitch1stParameter -eq "use" ) {
|
|
16
|
-
if ( $nodeswitch2ndParameter -eq "default" ) {
|
|
17
|
-
if ( $global:nodeswitchDefaultPATH -ne $null ) {
|
|
18
|
-
$env:Path = $global:nodeswitchDefaultPATH
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
|
|
22
|
-
if ( $global:nodeswitchDefaultPATH -eq $null ) {
|
|
23
|
-
$global:nodeswitchDefaultPATH = $env:Path
|
|
24
|
-
$env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$env:Path"
|
|
25
|
-
} else {
|
|
26
|
-
$env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$global:nodeswitchDefaultPATH"
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
echo "Node version not installed"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
} elseif ( $nodeswitch1stParameter -eq "add" ) {
|
|
33
|
-
if ( -not ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) ) {
|
|
34
|
-
cmd /c "curl -f https://nodejs.org/download/release/v$nodeswitch2ndParameter > nul 2>&1"
|
|
35
|
-
if ( $LASTEXITCODE -eq 0 ) {
|
|
36
|
-
cmd /c "curl -s -o $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip https://nodejs.org/download/release/v$nodeswitch2ndParameter/node-v$nodeswitch2ndParameter-win-x64.zip > nul"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
$nodeswitch1stParameter = $args[0]
|
|
2
|
+
$nodeswitch2ndParameter = $args[1]
|
|
3
|
+
|
|
4
|
+
if ( $nodeswitch1stParameter -ne $null ) {
|
|
5
|
+
if ( $nodeswitch2ndParameter -ne $null ) {
|
|
6
|
+
if ( $args[2] -ne $null ) {
|
|
7
|
+
echo "Incorrect command"
|
|
8
|
+
} else {
|
|
9
|
+
if ( $nodeswitch1stParameter -eq "remove" ) {
|
|
10
|
+
if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
|
|
11
|
+
Remove-Item -Recurse $env:AppData\nodeswitch\$nodeswitch2ndParameter
|
|
12
|
+
} else {
|
|
13
|
+
echo "Node version not installed"
|
|
14
|
+
}
|
|
15
|
+
} elseif ( $nodeswitch1stParameter -eq "use" ) {
|
|
16
|
+
if ( $nodeswitch2ndParameter -eq "default" ) {
|
|
17
|
+
if ( $global:nodeswitchDefaultPATH -ne $null ) {
|
|
18
|
+
$env:Path = $global:nodeswitchDefaultPATH
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
|
|
22
|
+
if ( $global:nodeswitchDefaultPATH -eq $null ) {
|
|
23
|
+
$global:nodeswitchDefaultPATH = $env:Path
|
|
24
|
+
$env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$env:Path"
|
|
25
|
+
} else {
|
|
26
|
+
$env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$global:nodeswitchDefaultPATH"
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
echo "Node version not installed"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
} elseif ( $nodeswitch1stParameter -eq "add" ) {
|
|
33
|
+
if ( -not ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) ) {
|
|
34
|
+
cmd /c "curl -f https://nodejs.org/download/release/v$nodeswitch2ndParameter > nul 2>&1"
|
|
35
|
+
if ( $LASTEXITCODE -eq 0 ) {
|
|
36
|
+
cmd /c "curl -s -o $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip https://nodejs.org/download/release/v$nodeswitch2ndParameter/node-v$nodeswitch2ndParameter-win-x64.zip > nul"
|
|
37
|
+
|
|
38
|
+
if ( $LASTEXITCODE -ne 0 ) {
|
|
39
|
+
del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
|
|
40
|
+
echo "Node version not created"
|
|
41
|
+
exit
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
tar -xf $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip -C $env:AppData\nodeswitch
|
|
45
|
+
|
|
46
|
+
if ( $LASTEXITCODE -ne 0 ) {
|
|
47
|
+
del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
|
|
48
|
+
Remove-Item -Recurse $env:AppData\nodeswitch\node-v$nodeswitch2ndParameter-win-x64
|
|
49
|
+
echo "Node version not created"
|
|
50
|
+
exit
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
|
|
54
|
+
cmd /c "move $env:AppData\nodeswitch\node-v$nodeswitch2ndParameter-win-x64 $env:AppData\nodeswitch\$nodeswitch2ndParameter > nul"
|
|
55
|
+
} else {
|
|
56
|
+
echo "Node version not found"
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
echo "Node version already added"
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
echo "Incorrect command"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
if ( $nodeswitch1stParameter -eq "list" ) {
|
|
67
|
+
dir -n $env:AppData\nodeswitch
|
|
68
|
+
} elseif ( $nodeswitch1stParameter -eq "path" ) {
|
|
69
|
+
echo "$env:AppData\nodeswitch"
|
|
70
|
+
} else {
|
|
71
|
+
echo "Incorrect command"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
echo "Incorrect command"
|
|
76
|
+
}
|
package/bin/nodeswitch.sh
CHANGED
|
@@ -1,70 +1,90 @@
|
|
|
1
|
-
if [ "$1" != "" ]
|
|
2
|
-
then
|
|
3
|
-
if [ "$2" != "" ]
|
|
4
|
-
then
|
|
5
|
-
if [ "$3" != "" ]
|
|
6
|
-
then
|
|
7
|
-
echo "Incorrect command"
|
|
8
|
-
else
|
|
9
|
-
if [ "$1" = "remove" ]
|
|
10
|
-
then
|
|
11
|
-
if [ -d "$APPDATA/nodeswitch/$2" ]
|
|
12
|
-
then
|
|
13
|
-
rm -rf $APPDATA/nodeswitch/$2
|
|
14
|
-
else
|
|
15
|
-
echo "Node version not installed"
|
|
16
|
-
fi
|
|
17
|
-
elif [ "$1" = "use" ]
|
|
18
|
-
then
|
|
19
|
-
if [ "$2" = "default" ]
|
|
20
|
-
then
|
|
21
|
-
if [ ! -z "$nodeswitchDefaultPATH" ]
|
|
22
|
-
then
|
|
23
|
-
export PATH=$nodeswitchDefaultPATH
|
|
24
|
-
fi
|
|
25
|
-
else
|
|
26
|
-
if [ -d "$APPDATA/nodeswitch/$2" ]
|
|
27
|
-
then
|
|
28
|
-
if [ -z "$nodeswitchDefaultPATH" ]
|
|
29
|
-
then
|
|
30
|
-
export nodeswitchDefaultPATH=$PATH
|
|
31
|
-
export PATH=$APPDATA/nodeswitch/$2:$PATH
|
|
32
|
-
else
|
|
33
|
-
export PATH=$APPDATA/nodeswitch/$2:$nodeswitchDefaultPATH
|
|
34
|
-
fi
|
|
35
|
-
else
|
|
36
|
-
echo "Node version not installed"
|
|
37
|
-
fi
|
|
38
|
-
fi
|
|
39
|
-
elif [ "$1" = "add" ]
|
|
40
|
-
then
|
|
41
|
-
if [ ! -d "$APPDATA/nodeswitch/$2" ]
|
|
42
|
-
then
|
|
43
|
-
curl -f https://nodejs.org/download/release/v$2 &>/dev/null
|
|
44
|
-
if [ $? -eq 0 ]
|
|
45
|
-
then
|
|
46
|
-
curl -s -o $APPDATA/nodeswitch/$2.zip https://nodejs.org/download/release/v$2/node-v$2-win-x64.zip > /dev/null
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
if [ "$1" != "" ]
|
|
2
|
+
then
|
|
3
|
+
if [ "$2" != "" ]
|
|
4
|
+
then
|
|
5
|
+
if [ "$3" != "" ]
|
|
6
|
+
then
|
|
7
|
+
echo "Incorrect command"
|
|
8
|
+
else
|
|
9
|
+
if [ "$1" = "remove" ]
|
|
10
|
+
then
|
|
11
|
+
if [ -d "$APPDATA/nodeswitch/$2" ]
|
|
12
|
+
then
|
|
13
|
+
rm -rf $APPDATA/nodeswitch/$2
|
|
14
|
+
else
|
|
15
|
+
echo "Node version not installed"
|
|
16
|
+
fi
|
|
17
|
+
elif [ "$1" = "use" ]
|
|
18
|
+
then
|
|
19
|
+
if [ "$2" = "default" ]
|
|
20
|
+
then
|
|
21
|
+
if [ ! -z "$nodeswitchDefaultPATH" ]
|
|
22
|
+
then
|
|
23
|
+
export PATH=$nodeswitchDefaultPATH
|
|
24
|
+
fi
|
|
25
|
+
else
|
|
26
|
+
if [ -d "$APPDATA/nodeswitch/$2" ]
|
|
27
|
+
then
|
|
28
|
+
if [ -z "$nodeswitchDefaultPATH" ]
|
|
29
|
+
then
|
|
30
|
+
export nodeswitchDefaultPATH=$PATH
|
|
31
|
+
export PATH=$APPDATA/nodeswitch/$2:$PATH
|
|
32
|
+
else
|
|
33
|
+
export PATH=$APPDATA/nodeswitch/$2:$nodeswitchDefaultPATH
|
|
34
|
+
fi
|
|
35
|
+
else
|
|
36
|
+
echo "Node version not installed"
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
elif [ "$1" = "add" ]
|
|
40
|
+
then
|
|
41
|
+
if [ ! -d "$APPDATA/nodeswitch/$2" ]
|
|
42
|
+
then
|
|
43
|
+
curl -f https://nodejs.org/download/release/v$2 &>/dev/null
|
|
44
|
+
if [ $? -eq 0 ]
|
|
45
|
+
then
|
|
46
|
+
curl -s -o $APPDATA/nodeswitch/$2.zip https://nodejs.org/download/release/v$2/node-v$2-win-x64.zip > /dev/null
|
|
47
|
+
|
|
48
|
+
if [ $? -ne 0 ]
|
|
49
|
+
then
|
|
50
|
+
rm $APPDATA/nodeswitch/$2.zip
|
|
51
|
+
echo "Node version not created"
|
|
52
|
+
exit
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
unzip -d $APPDATA/nodeswitch -o $APPDATA/nodeswitch/$2.zip > /dev/null
|
|
56
|
+
|
|
57
|
+
if [ $? -ne 0 ]
|
|
58
|
+
then
|
|
59
|
+
rm $APPDATA/nodeswitch/$2.zip
|
|
60
|
+
rm -rf $APPDATA/nodeswitch/node-v$2-win-x64
|
|
61
|
+
echo "Node version not created"
|
|
62
|
+
exit
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
rm $APPDATA/nodeswitch/$2.zip
|
|
66
|
+
mv $APPDATA/nodeswitch/node-v$2-win-x64 $APPDATA/nodeswitch/$2 > /dev/null
|
|
67
|
+
else
|
|
68
|
+
echo "Node version not found"
|
|
69
|
+
fi
|
|
70
|
+
else
|
|
71
|
+
echo "Node version already added"
|
|
72
|
+
fi
|
|
73
|
+
else
|
|
74
|
+
echo "Incorrect command"
|
|
75
|
+
fi
|
|
76
|
+
fi
|
|
77
|
+
else
|
|
78
|
+
if [ "$1" = "list" ]
|
|
79
|
+
then
|
|
80
|
+
dir -1 $APPDATA/nodeswitch
|
|
81
|
+
elif [ "$1" = "path" ]
|
|
82
|
+
then
|
|
83
|
+
echo "$APPDATA\nodeswitch"
|
|
84
|
+
else
|
|
85
|
+
echo "Incorrect command"
|
|
86
|
+
fi
|
|
87
|
+
fi
|
|
88
|
+
else
|
|
89
|
+
echo "Incorrect command"
|
|
90
|
+
fi
|