Compare commits

...

3 Commits

Author SHA1 Message Date
Lea Anthony
3ac993b01f Version bump 2019-02-23 13:26:03 +11:00
Lea Anthony
216c84b9cf Added version command to check after update 2019-02-23 12:56:40 +11:00
Lea Anthony
e99fffe340 Version bump 2019-02-23 10:25:31 +11:00
4 changed files with 37 additions and 3 deletions

View File

@@ -106,6 +106,15 @@ func (p *ProgramHelper) RunCommand(command string) error {
return p.RunCommandArray(args)
}
func (p *ProgramHelper) GetOutputFromCommand(command string) (string, string, error) {
args := strings.Split(command, " ")
if len(args) > 1 {
return p.shell.Run(args[0], args[1:]...)
} else {
return p.shell.Run(args[0])
}
}
// RunCommandArray runs the command specified in the array
func (p *ProgramHelper) RunCommandArray(args []string) error {
program := args[0]

View File

@@ -2,4 +2,4 @@ package cmd
// Version - Wails version
// ...oO(There must be a better way)
const Version = "v0.9.2"
const Version = "v0.9.4"

20
cmd/wails/10_version.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/wailsapp/wails/cmd"
)
func init() {
commandDescription := `Outputs the current version of the wails cli tool.`
versionCommand := app.Command("version", "Print Wails cli version").
LongDescription(commandDescription)
versionCommand.Action(func() error {
fmt.Println(cmd.Version)
return nil
})
}

View File

@@ -54,13 +54,18 @@ func init() {
updateSpinner := spinner.NewSpinner()
updateSpinner.SetSpinSpeed(40)
updateSpinner.Start("Updating to : " + latestVersion)
err = cmd.NewProgramHelper().RunCommandArray([]string{"go","get","-u","github.com/wailsapp/wails/cmd/wails"})
err = cmd.NewProgramHelper().RunCommandArray([]string{"go","get","-u","-v","github.com/wailsapp/wails/cmd/wails"})
if err != nil {
updateSpinner.Error(err.Error())
return err
}
updateSpinner.Success()
logger.Yellow("Wails updated to " + latestVersion)
version, _, err := cmd.NewProgramHelper().GetOutputFromCommand("wails version")
if err != nil {
updateSpinner.Error(err.Error())
return err
}
logger.Yellow("Wails updated to " + version)
} else {
logger.Yellow("Looks like you're up to date!")
}