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

37 lines
728 B
Go
Raw Normal View History

package cli
2022-03-12 13:04:08 -08:00
import (
2022-03-19 11:48:37 -07:00
"fmt"
"os"
"time"
2022-03-12 13:04:08 -08:00
"github.com/spf13/cobra"
)
// configCmd represents the config command
var configCmd = &cobra.Command{
2022-03-19 11:48:37 -07:00
Use: "config [export|migrate|edit]",
2022-03-12 13:04:08 -08:00
Short: "Interact with the configuration",
Long: `Interact with the configuration
2022-03-19 11:48:37 -07:00
It allows to export, migrate or edit the configuration.`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
_ = cmd.Help()
return
}
switch args[0] {
case "edit":
editFileWithEditor(os.Getenv("POSH_THEME"))
case "get":
// only here for backwards compatibility
fmt.Print(time.Now().UnixNano() / 1000000)
default:
_ = cmd.Help()
}
},
2022-03-12 13:04:08 -08:00
}
func init() { // nolint:gochecknoinits
rootCmd.AddCommand(configCmd)
}