File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,3 +95,9 @@ Run eslint --fix on running containers (Clark and SCE-discord-bot only):
9595sce lint <project>
9696```
9797Make sure the project is running with ` sce run ` first.
98+
99+ ### Update
100+ Update the SCE CLI to the latest version. Runs the appropriate install script for your platform:
101+ ```
102+ sce update
103+ ```
Original file line number Diff line number Diff line change 1+ package cmd
2+
3+ import (
4+ "os"
5+ "os/exec"
6+ "runtime"
7+
8+ "github.com/spf13/cobra"
9+ )
10+
11+ const (
12+ unixInstallURL = "https://raw.githubusercontent.com/SCE-Development/SCE-CLI/master/go/install.sh"
13+ windowsInstallURL = "https://raw.githubusercontent.com/SCE-Development/SCE-CLI/master/go/install.ps1"
14+ )
15+
16+ var updateCmd = & cobra.Command {
17+ Use : "update" ,
18+ Short : "Update the SCE CLI to the latest version" ,
19+ Args : cobra .NoArgs ,
20+ Run : func (cmd * cobra.Command , args []string ) {
21+ var c * exec.Cmd
22+ if runtime .GOOS == "windows" {
23+ c = exec .Command ("powershell" , "-Command" ,
24+ "Invoke-WebRequest -Uri \" " + windowsInstallURL + "\" -UseBasicParsing | Invoke-Expression" )
25+ } else {
26+ c = exec .Command ("sh" , "-c" , "curl -sSL " + unixInstallURL + " | sh" )
27+ }
28+ c .Stdout = os .Stdout
29+ c .Stderr = os .Stderr
30+ c .Stdin = os .Stdin
31+ if err := c .Run (); err != nil {
32+ os .Exit (1 )
33+ }
34+ },
35+ }
36+
37+ func init () {
38+ rootCmd .AddCommand (updateCmd )
39+ }
You can’t perform that action at this time.
0 commit comments