From b6e133c60873c5ec41b6ebaf28e98043ac36cd58 Mon Sep 17 00:00:00 2001 From: raul Date: Fri, 10 May 2024 07:58:12 +0200 Subject: [PATCH] Clean up Cobra files --- cmd/client.go | 11 ----------- cmd/root.go | 15 --------------- cmd/server.go | 11 ----------- 3 files changed, 37 deletions(-) diff --git a/cmd/client.go b/cmd/client.go index fba8423..6f658e1 100644 --- a/cmd/client.go +++ b/cmd/client.go @@ -10,7 +10,6 @@ import ( "os" ) -// clientCmd represents the client command var clientCmd = &cobra.Command{ Use: "client", Short: "Client interface for mini-chat", @@ -35,18 +34,8 @@ Example: func init() { rootCmd.AddCommand(clientCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // clientCmd.PersistentFlags().String("foo", "", "A help for foo") clientCmd.PersistentFlags().StringP("ip", "i", "", "Server IP to connect to") clientCmd.PersistentFlags().StringP("port", "p", "1302", "Server port to connect to") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // clientCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } func setClientParameters(cmd *cobra.Command) error { diff --git a/cmd/root.go b/cmd/root.go index 57577e0..3557b46 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -9,19 +9,13 @@ import ( "os" ) -// rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "mini-chat", Short: "Application for hosting and joining a simple chat server", Long: `Application for hosting and joining a simple chat server`, - // Uncomment the following line if your bare application - // has an action associated with it: - // Run: func(cmd *cobra.Command, args []string) { }, } -// Execute adds all child commands to the root command and sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { err := rootCmd.Execute() if err != nil { @@ -30,13 +24,4 @@ func Execute() { } func init() { - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application. - - // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.chat-tests.yaml)") - - // Cobra also supports local flags, which will only run - // when this action is called directly. - rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } diff --git a/cmd/server.go b/cmd/server.go index 7e2903a..918bf04 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -9,7 +9,6 @@ import ( "log" ) -// serverCmd represents the server command var serverCmd = &cobra.Command{ Use: "server", Short: "Tiny chat server", @@ -30,18 +29,8 @@ Example: func init() { rootCmd.AddCommand(serverCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // serverCmd.PersistentFlags().String("foo", "", "A help for foo") serverCmd.PersistentFlags().StringP("port", "p", "1302", "port to use for listening") serverCmd.PersistentFlags().StringP("history", "r", "", "File to store and recover chat history from") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // serverCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } func setServerParameters(cmd *cobra.Command) error {