-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
info
command and rename to version
Previously the `info` command printed more detailed application information compared to the compact and machine-friendly `--version` global flag. The name of command was not optimal as it could give the impression that it provides more "info"rmation about one or more snowblocks that might be passed as argument(s). Therefore the command has been renamed to `version` which also matches the naming of many other Go CLI apps like Kubernetes [1] `kubectl` [2]. To also enhance the provided information the command now prints more application version details using the function implemented in GH-93. [1]: https://kubernetes.io [2]: https://github.com/kubernetes/kubernetes/tree/master/pkg/kubectl Epic GH-33 Relates to GH-93 GH-94
- Loading branch information
1 parent
532e680
commit 2cd8e0a
Showing
5 changed files
with
69 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (C) 2017-present Arctic Ice Studio <[email protected]> | ||
// Copyright (C) 2017-present Sven Greb <[email protected]> | ||
// | ||
// Project: snowsaw | ||
// Repository: https://github.com/arcticicestudio/snowsaw | ||
// License: MIT | ||
|
||
// Author: Arctic Ice Studio <[email protected]> | ||
// Author: Sven Greb <[email protected]> | ||
// Since: 0.4.0 | ||
|
||
// Package version provides the version command to print more detailed application version information. | ||
package version | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/fatih/color" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/arcticicestudio/snowsaw/pkg/config" | ||
) | ||
|
||
// NewVersionCmd creates and configures a new `version` command. | ||
func NewVersionCmd() *cobra.Command { | ||
versionCmd := &cobra.Command{ | ||
Use: "version", | ||
Short: "Prints more detailed application version information", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println(fmt.Sprintf("%s %s build at %s with %s", | ||
color.CyanString(config.ProjectName), | ||
color.BlueString(config.AppVersion), | ||
color.GreenString(config.AppVersionBuildDateTime), | ||
color.BlueString(config.AppVersionGoRuntime))) | ||
}, | ||
} | ||
|
||
return versionCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters