refactor: move flag to internal/common

This commit is contained in:
decentral1se 2021-12-19 16:00:16 +01:00
parent a925da8dee
commit 9ddf69b988
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 13 additions and 10 deletions

View File

@ -284,6 +284,17 @@ var VerboseFlag = &cli.BoolFlag{
Usage: "Show INFO messages",
}
// RC signifies the latest release candidate
var RC bool
// RCFlag chooses the latest release candidate for install
var RCFlag = &cli.BoolFlag{
Name: "rc",
Value: false,
Destination: &RC,
Usage: "Insatll the latest release candidate",
}
// SSHFailMsg is a hopefully helpful SSH failure message
var SSHFailMsg = `
Woops, Abra is unable to connect to connect to %s.

View File

@ -8,22 +8,14 @@ import (
"github.com/urfave/cli/v2"
)
var RC bool
var RCFlag = &cli.BoolFlag{
Name: "rc",
Value: false,
Destination: &RC,
Usage: "Insatll the latest Release Candidate",
}
// UpgradeCommand upgrades abra in-place.
var UpgradeCommand = &cli.Command{
Name: "upgrade",
Usage: "Upgrade abra",
Flags: []cli.Flag{RCFlag},
Flags: []cli.Flag{internal.RCFlag},
Action: func(c *cli.Context) error {
cmd := exec.Command("bash", "-c", "curl -s https://install.abra.coopcloud.tech | bash")
if RC {
if internal.RC {
cmd = exec.Command("bash", "-c", "curl -s https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer | bash -s -- --rc")
}
logrus.Debugf("attempting to run '%s'", cmd)