Skip to content

Commit

Permalink
Streamline message names
Browse files Browse the repository at this point in the history
  • Loading branch information
andscoop committed Jun 28, 2018
1 parent edbbfd1 commit 3493b08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions messages/messages.go
Expand Up @@ -4,14 +4,14 @@ var (
ERROR_INVALID_CLI_VERSION = "Astronomer CLI version is not valid"
ERROR_GITHUB_JSON_MARSHALLING = "Failed to JSON decode Github response from %s"

INFO_CURR_CLI_VERSION = "Astro CLI Version: v%s"
INFO_CURR_CLI_COMMIT = "Git Commit: %s"
INFO_CURR_CLI_VERSION_DATE = INFO_CURR_CLI_VERSION + " (%s)"
INFO_LATEST_CLI_VERSION = "Astro CLI Latest: %s "
INFO_LATEST_CLI_VERSION_DATE = INFO_LATEST_CLI_VERSION + " (%s)"
INFO_CLI_INSTALL_CMD = "\t$ curl -sL https://install.astronomer.io | sudo bash"
INFO_UPGRADE_CLI = "There is a more recent version of the Astronomer CLI available.\nYou can install the latest tagged release with the following command"
INFO_UNTAGGED_VERSION = "Your current Astronomer CLI is not tagged.\nThis is likely the result of building from source. You can install the latest tagged release with the following command"
CLI_CURR_VERSION = "Astro CLI Version: v%s"
CLI_CURR_COMMIT = "Git Commit: %s"
CLI_CURR_VERSION_DATE = CLI_CURR_VERSION + " (%s)"
CLI_LATEST_VERSION = "Astro CLI Latest: %s "
CLI_LATEST_VERSION_DATE = CLI_LATEST_VERSION + " (%s)"
CLI_INSTALL_CMD = "\t$ curl -sL https://install.astronomer.io | sudo bash"
CLI_UPGRADE_PROMPT = "There is a more recent version of the Astronomer CLI available.\nYou can install the latest tagged release with the following command"
CLI_UNTAGGED_PROMPT = "Your current Astronomer CLI is not tagged.\nThis is likely the result of building from source. You can install the latest tagged release with the following command"

NA = "N/A"
)
16 changes: 8 additions & 8 deletions version/version.go
Expand Up @@ -18,16 +18,16 @@ func PrintVersion(version, gitCommit string) error {
return errors.New(messages.ERROR_INVALID_CLI_VERSION)
}

fmt.Printf(messages.INFO_CURR_CLI_VERSION+"\n", version)
fmt.Printf(messages.INFO_CURR_CLI_COMMIT+"\n", gitCommit)
fmt.Printf(messages.CLI_CURR_VERSION+"\n", version)
fmt.Printf(messages.CLI_CURR_COMMIT+"\n", gitCommit)
return nil
}

// CheckForUpdate checks current version against latest on github
func CheckForUpdate(version, gitCommit string) error {
if !isValidVersion(version) {
fmt.Println(messages.INFO_UNTAGGED_VERSION)
fmt.Println(messages.INFO_CLI_INSTALL_CMD)
fmt.Println(messages.CLI_UNTAGGED_PROMPT)
fmt.Println(messages.CLI_INSTALL_CMD)
return nil
}

Expand All @@ -49,10 +49,10 @@ func CheckForUpdate(version, gitCommit string) error {
latestTag := latestTagResp.TagName

if latestTagResp.TagName > version {
fmt.Printf(messages.INFO_CURR_CLI_VERSION_DATE+"\n", version, currentPub)
fmt.Printf(messages.INFO_LATEST_CLI_VERSION_DATE+"\n", latestTag, latestPub)
fmt.Println(messages.INFO_UPGRADE_CLI)
fmt.Println(messages.INFO_CLI_INSTALL_CMD)
fmt.Printf(messages.CLI_CURR_VERSION_DATE+"\n", version, currentPub)
fmt.Printf(messages.CLI_LATEST_VERSION_DATE+"\n", latestTag, latestPub)
fmt.Println(messages.CLI_UPGRADE_PROMPT)
fmt.Println(messages.CLI_INSTALL_CMD)
return nil
}

Expand Down

0 comments on commit 3493b08

Please sign in to comment.