feat(cmd): remove warn log, disable cmd sorting

remove warn log, disable cmd sorting

Signed-off-by: mritd <mritd@linux.com>
This commit is contained in:
mritd 2022-02-14 14:43:25 +08:00
parent 870e13ed4c
commit cb994c47a9
No known key found for this signature in database
GPG Key ID: 150E1851F767CDDD
2 changed files with 4 additions and 6 deletions

View File

@ -65,7 +65,3 @@ PowerShell:
}
},
}
func init() {
rootCmd.AddCommand(completionCmd)
}

View File

@ -130,7 +130,6 @@ func fakeFlags() {
for _, arg := range os.Args {
if fr.MatchString(arg) {
args = append(args, "-"+arg)
logrus.WithField("FLAG", arg).Warn("flag format is not standard, please use standard POSIX format(-h/--help)")
} else {
args = append(args, arg)
}
@ -145,6 +144,9 @@ func init() {
// compatible windows double click
cobra.MousetrapHelpText = ""
// disable cmd sorting
cobra.EnableCommandSorting = false
// add global flags
rootCmd.PersistentFlags().StringP("config", "c", "./config.json", "config file")
rootCmd.PersistentFlags().String("mmdb-url", "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb", "mmdb download url")
@ -154,7 +156,7 @@ func init() {
rootCmd.PersistentFlags().Bool("no-check", false, "disable update check")
// add to root cmd
rootCmd.AddCommand(clientCmd, serverCmd)
rootCmd.AddCommand(clientCmd, serverCmd, completionCmd)
// bind flag
_ = viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config"))