2022-03-12 22:43:32 -08:00
|
|
|
package cli
|
2022-03-12 13:04:08 -08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2023-07-02 11:53:50 -07:00
|
|
|
"github.com/jandedobbeleer/oh-my-posh/src/build"
|
2022-03-12 13:04:08 -08:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2023-07-02 11:53:50 -07:00
|
|
|
var (
|
|
|
|
verbose bool
|
|
|
|
)
|
|
|
|
|
2022-03-12 13:04:08 -08:00
|
|
|
// versionCmd represents the version command
|
|
|
|
var versionCmd = &cobra.Command{
|
|
|
|
Use: "version",
|
|
|
|
Short: "Print the version",
|
2022-05-05 02:26:20 -07:00
|
|
|
Long: "Print the version number of oh-my-posh.",
|
|
|
|
Args: cobra.NoArgs,
|
2024-02-08 17:02:30 -08:00
|
|
|
Run: func(_ *cobra.Command, _ []string) {
|
2023-07-02 11:53:50 -07:00
|
|
|
if !verbose {
|
|
|
|
fmt.Println(build.Version)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
fmt.Println("Version: ", build.Version)
|
|
|
|
fmt.Println("Date: ", build.Date)
|
2022-03-12 13:04:08 -08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2024-05-03 23:02:16 -07:00
|
|
|
func init() {
|
2023-07-02 11:53:50 -07:00
|
|
|
versionCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "write verbose output")
|
2022-11-02 03:48:19 -07:00
|
|
|
RootCmd.AddCommand(versionCmd)
|
2022-03-12 13:04:08 -08:00
|
|
|
}
|