-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add "version" command to display git version string (#221)
* add "version" command to display git version string * drop unused parameter
- Loading branch information
1 parent
d585b9d
commit 805b686
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
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
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,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
var versionString = "development" | ||
|
||
// versionCmd setups version command | ||
func versionCmd(_ *pflag.FlagSet) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "version", | ||
Short: "Display KubeOne version", | ||
Long: `Prints the exact version number, as embedded by the build system.`, | ||
Args: cobra.ExactArgs(0), | ||
RunE: func(_ *cobra.Command, args []string) error { | ||
fmt.Printf("KubeOne %s\n", versionString) | ||
return nil | ||
}, | ||
} | ||
|
||
return cmd | ||
} |