Files
aqi/internal/cli/templates/default/cmd/boot.go.tmpl
2025-05-26 10:47:52 +08:00

38 lines
744 B
Cheetah
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package cmd
import (
"fmt"
"os"
"path/filepath"
"strings"
_ "time/tzdata"
"github.com/spf13/cobra"
)
var timezone string
var configFile string
func init() {
rootCmd.PersistentFlags().StringVarP(&timezone, "tz", "t", "default", "指定时区")
rootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "config.yaml", "指定配置文件路径默认当前路径下config.yaml")
cobra.OnInitialize(func() {
})
}
var runApp = filepath.Base(strings.TrimLeft(os.Args[0], "./"))
var rootCmd = &cobra.Command{
Use: runApp,
Version: "{{.PackageName}}",
Run: func(cmd *cobra.Command, args []string) {
_ = cmd.Help()
},
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}