mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
308ce40302
commit
0bd957fc76
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -90,7 +90,7 @@ var printCmd = &cobra.Command{
|
|||
}
|
||||
switch args[0] {
|
||||
case "debug":
|
||||
fmt.Print(eng.PrintDebug(Version))
|
||||
fmt.Print(eng.PrintDebug(cliVersion))
|
||||
case "primary":
|
||||
fmt.Print(eng.PrintPrimary())
|
||||
case "secondary":
|
|
@ -1,4 +1,4 @@
|
|||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -9,8 +9,9 @@ import (
|
|||
|
||||
// Version number of oh-my-posh
|
||||
var (
|
||||
Version = "development"
|
||||
config string
|
||||
config string
|
||||
displayVersion bool
|
||||
cliVersion string
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
|
@ -25,11 +26,15 @@ on getting started, have a look at the docs at https://ohmyposh.dev`,
|
|||
runInit(shell)
|
||||
return
|
||||
}
|
||||
fmt.Println(Version)
|
||||
if displayVersion {
|
||||
fmt.Println(cliVersion)
|
||||
return
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
func Execute(version string) {
|
||||
cliVersion = version
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
|
@ -45,5 +50,6 @@ var (
|
|||
func init() { // nolint:gochecknoinits
|
||||
rootCmd.PersistentFlags().StringVarP(&config, "config", "c", "", "config (required)")
|
||||
rootCmd.Flags().BoolVarP(&initialize, "init", "i", false, "init (deprecated)")
|
||||
rootCmd.Flags().BoolVar(&displayVersion, "version", false, "version")
|
||||
rootCmd.Flags().StringVarP(&shell, "shell", "s", "", "shell (deprecated)")
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -16,7 +16,7 @@ var versionCmd = &cobra.Command{
|
|||
Short: "Print the version",
|
||||
Long: "Print oh-my-posh version and build information.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(Version)
|
||||
fmt.Println(cliVersion)
|
||||
},
|
||||
}
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
package main
|
||||
|
||||
import "oh-my-posh/cmd"
|
||||
import "oh-my-posh/cli"
|
||||
|
||||
var (
|
||||
Version = "development"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
cli.Execute(Version)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue