From b8e66a19245e85160db324c6cbf1c5d8b1d7559a Mon Sep 17 00:00:00 2001 From: vilmibm Date: Thu, 21 Jan 2021 23:47:10 +0000 Subject: [PATCH] this seems fine --- main.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/main.go b/main.go index 192d419..90f4dd6 100644 --- a/main.go +++ b/main.go @@ -16,19 +16,13 @@ import ( const binroot = "/town/commands" var rootCmd = &cobra.Command{ - Use: "town", - Short: "Run commands unique to tilde.town", - DisableFlagParsing: true, -} - -func init() { - rootCmd.Flags().BoolP("help", "h", false, "") + Use: "town", + Short: "Run commands unique to tilde.town", } var adminCmd = &cobra.Command{ - Use: "admin", - Short: "Run administrative commands", - DisableFlagParsing: true, + Use: "admin", + Short: "Run administrative commands", } func isAdmin() (bool, error) { @@ -109,8 +103,9 @@ func parseCommand(targetCmd *cobra.Command, yamlPath string) { } parsedCmd := &cobra.Command{ - Use: filepath.Base(executablePath), - RunE: execWrapper(executablePath), + Use: filepath.Base(executablePath), + RunE: execWrapper(executablePath), + DisableFlagParsing: true, } if doc.ShortDesc != "" { parsedCmd.Short = doc.ShortDesc @@ -140,7 +135,6 @@ func execWrapper(executablePath string) func(*cobra.Command, []string) error { } func cli() int { - rootCommand.PersistentFlags().BoolFlagP("help", "h", false) err := parseCommands(rootCmd, "core") if err != nil { fmt.Fprintf(os.Stderr, "failed to parse core commands: %s", err)