Add --beta flag to reshctl update

pull/174/head v2.8.0-beta1
Simon Let 4 years ago
parent a88acedde0
commit c212a81934
No known key found for this signature in database
GPG Key ID: D650C65DD46D431D
  1. 1
      cmd/control/cmd/root.go
  2. 7
      cmd/control/cmd/update.go
  3. 4
      scripts/rawinstall.sh

@ -58,6 +58,7 @@ func Execute(ver, com string) status.Code {
rootCmd.AddCommand(statusCmd) rootCmd.AddCommand(statusCmd)
updateCmd.Flags().BoolVar(&betaFlag, "beta", false, "Update to latest version even if it's beta.")
rootCmd.AddCommand(updateCmd) rootCmd.AddCommand(updateCmd)
rootCmd.AddCommand(sanitizeCmd) rootCmd.AddCommand(sanitizeCmd)

@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var betaFlag bool
var updateCmd = &cobra.Command{ var updateCmd = &cobra.Command{
Use: "update", Use: "update",
Short: "check for updates and update RESH", Short: "check for updates and update RESH",
@ -17,7 +18,11 @@ var updateCmd = &cobra.Command{
usr, _ := user.Current() usr, _ := user.Current()
dir := usr.HomeDir dir := usr.HomeDir
rawinstallPath := filepath.Join(dir, ".resh/rawinstall.sh") rawinstallPath := filepath.Join(dir, ".resh/rawinstall.sh")
execCmd := exec.Command("bash", rawinstallPath) execArgs := []string{rawinstallPath}
if betaFlag {
execArgs = append(execArgs, "--beta")
}
execCmd := exec.Command("bash", execArgs...)
execCmd.Stdout = os.Stdout execCmd.Stdout = os.Stdout
execCmd.Stderr = os.Stderr execCmd.Stderr = os.Stderr
err := execCmd.Run() err := execCmd.Run()

@ -6,8 +6,8 @@ echo
echo "Please report any issues you encounter to: https://github.com/curusarn/resh/issues" echo "Please report any issues you encounter to: https://github.com/curusarn/resh/issues"
echo echo
if [ "${1-}" = "--test" ] || [ "${1-}" = "-t" ]; then if [ "${1-}" = "--beta" ] || [ "${1-}" = "-b" ]; then
echo "Looking for the latest release or PRERELEASE (because you used --test flag) ..." echo "Looking for the latest release or PRERELEASE (because you used --beta flag) ..."
# debug # debug
# latest release OR pre-release # latest release OR pre-release
json=$(curl --silent "https://api.github.com/repos/curusarn/resh/releases") json=$(curl --silent "https://api.github.com/repos/curusarn/resh/releases")

Loading…
Cancel
Save