Compare commits
2 Commits
v0.7.0
..
e97aaf9c8c
| Author | SHA1 | Date | |
|---|---|---|---|
| e97aaf9c8c | |||
| 5aab1a3303 |
@@ -1,2 +1 @@
|
|||||||
.tmp
|
.tmp
|
||||||
.version
|
|
||||||
|
|||||||
+2
-5
@@ -2,8 +2,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -14,9 +12,8 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
rootCmd = &cobra.Command{
|
rootCmd = &cobra.Command{
|
||||||
Use: CmdName,
|
Use: CmdName,
|
||||||
Short: "control tool for jpi.cloud",
|
Short: "control tool for jpi.cloud",
|
||||||
Version: version,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "embed"
|
|
||||||
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:generate sh -c "git describe | tr -d '\r\n' > .version"
|
|
||||||
//go:embed .version
|
|
||||||
var version string
|
|
||||||
|
|
||||||
var versionCmd = &cobra.Command{
|
|
||||||
Use: "version",
|
|
||||||
Short: "Returns jpictl's version",
|
|
||||||
Args: cobra.NoArgs,
|
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
|
||||||
_, _ = fmt.Fprintf(os.Stdout, "%s\n", version)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
if version == "" {
|
|
||||||
version = "undetermined"
|
|
||||||
}
|
|
||||||
|
|
||||||
rootCmd.AddCommand(versionCmd)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user