Commit e26cf4d6 authored by SWE CI's avatar SWE CI

Merge branch 'release/v0.1.5'

parents 79619be3 8e41b52e
Pipeline #29491 passed with stage
in 21 seconds
// Copyright © 2019 NAME HERE <EMAIL ADDRESS>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cmd
import (
"fmt"
"git.psu.edu/swe-golang/buildversion"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "displays the software version",
Run: func(cmd *cobra.Command, args []string) {
version := buildversion.Get()
if version.Version == "" {
color.Red("No build information present")
return
}
fmt.Printf("Version: %s\n", buildversion.Get().Version)
fmt.Printf("Build Date: %s\n", buildversion.Get().BuildDate)
fmt.Printf("Commit: %s\n", buildversion.Get().Commit)
fmt.Printf("GoVersion: %s\n", buildversion.Get().GoVersion)
fmt.Printf("PipeID: %s\n", buildversion.Get().PipeID)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// versionCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
......@@ -3,6 +3,7 @@ module git.psu.edu/k8s/devtool
go 1.12
require (
git.psu.edu/swe-golang/buildversion v0.1.0
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/fatih/color v1.7.0
......
git.psu.edu/swe-golang/buildversion v0.1.0 h1:MA5Sd3m5Uuq+UoH8vwtSX7n/tHLTW7cH7I0884kquSc=
git.psu.edu/swe-golang/buildversion v0.1.0/go.mod h1:3GggCLs0kp53vq0x5DC+ZXLK4dMW+GyUB9wlflz8PmA=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/alecthomas/gometalinter v2.0.11+incompatible h1:ENdXMllZNSVDTJUUVIzBW9CSEpntTrQa76iRsEFLX/M=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment