Compare commits
13 Commits
v0.8.0
..
01eae6bee9
| Author | SHA1 | Date | |
|---|---|---|---|
| 01eae6bee9 | |||
| 4bb1246292 | |||
| f5d76ad6a5 | |||
| b7016f28d3 | |||
| 1d3db78dd6 | |||
| 2075b2b730 | |||
| cedca2d3d8 | |||
| ae9f941bfc | |||
| 48cfc710f8 | |||
| 0bb8375301 | |||
| 299556544d | |||
| 464c968381 | |||
| d51275fb1e |
@@ -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