From 3a06d99c8b4bbba4e8ff103fb711015a1a87e8b3 Mon Sep 17 00:00:00 2001 From: AntoineH Date: Tue, 3 Sep 2024 11:40:35 +0200 Subject: [PATCH] Define initial CLI --- src/cmd/controller.go | 40 ++++++++++++++++++++++++++++++++++++++++ src/cmd/listen.go | 40 ++++++++++++++++++++++++++++++++++++++++ src/cmd/motor.go | 40 ++++++++++++++++++++++++++++++++++++++++ src/cmd/moveVel.go | 40 ++++++++++++++++++++++++++++++++++++++++ src/cmd/serve.go | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 200 insertions(+) create mode 100644 src/cmd/controller.go create mode 100644 src/cmd/listen.go create mode 100644 src/cmd/motor.go create mode 100644 src/cmd/moveVel.go create mode 100644 src/cmd/serve.go diff --git a/src/cmd/controller.go b/src/cmd/controller.go new file mode 100644 index 0000000..229b54f --- /dev/null +++ b/src/cmd/controller.go @@ -0,0 +1,40 @@ +/* +Copyright © 2024 Antoine Harle antoine.harle@proton.me + +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// controllerCmd represents the controller command +var controllerCmd = &cobra.Command{ + Use: "controller", + Short: "A brief description of your command", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("controller called") + }, +} + +func init() { + rootCmd.AddCommand(controllerCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // controllerCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // controllerCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/src/cmd/listen.go b/src/cmd/listen.go new file mode 100644 index 0000000..c526b63 --- /dev/null +++ b/src/cmd/listen.go @@ -0,0 +1,40 @@ +/* +Copyright © 2024 Antoine Harle antoine.harle@proton.me + +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// listenCmd represents the listen command +var listenCmd = &cobra.Command{ + Use: "listen", + Short: "A brief description of your command", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("listen called") + }, +} + +func init() { + motorCmd.AddCommand(listenCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // listenCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // listenCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/src/cmd/motor.go b/src/cmd/motor.go new file mode 100644 index 0000000..7f58dce --- /dev/null +++ b/src/cmd/motor.go @@ -0,0 +1,40 @@ +/* +Copyright © 2024 Antoine Harle antoine.harle@proton.me + +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// motorCmd represents the motor command +var motorCmd = &cobra.Command{ + Use: "motor", + Short: "A brief description of your command", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("motor called") + }, +} + +func init() { + rootCmd.AddCommand(motorCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // motorCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // motorCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/src/cmd/moveVel.go b/src/cmd/moveVel.go new file mode 100644 index 0000000..9e59769 --- /dev/null +++ b/src/cmd/moveVel.go @@ -0,0 +1,40 @@ +/* +Copyright © 2024 Antoine Harle antoine.harle@proton.me + +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// moveVelCmd represents the moveVel command +var moveVelCmd = &cobra.Command{ + Use: "moveVel", + Short: "A brief description of your command", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("moveVel called") + }, +} + +func init() { + motorCmd.AddCommand(moveVelCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // moveVelCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // moveVelCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/src/cmd/serve.go b/src/cmd/serve.go new file mode 100644 index 0000000..e28b668 --- /dev/null +++ b/src/cmd/serve.go @@ -0,0 +1,40 @@ +/* +Copyright © 2024 Antoine Harle antoine.harle@proton.me + +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// serveCmd represents the serve command +var serveCmd = &cobra.Command{ + Use: "serve", + Short: "A brief description of your command", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("serve called") + }, +} + +func init() { + motorCmd.AddCommand(serveCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // serveCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // serveCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +}