oh-my-posh/src/cli/version.go

34 lines
656 B
Go
Raw Normal View History

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",
Long: "Print the version number of oh-my-posh.",
Args: cobra.NoArgs,
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
}