|
| 1 | +/* |
| 2 | +Copyright © 2025 NAME HERE <EMAIL ADDRESS> |
| 3 | +
|
| 4 | +*/ |
| 5 | +package cmd |
| 6 | + |
| 7 | +import ( |
| 8 | + "fmt" |
| 9 | + |
| 10 | + "github.com/spf13/cobra" |
| 11 | +) |
| 12 | + |
| 13 | +// InstallCodesphereCmd represents the codesphere command |
| 14 | +type InstallCodesphereCmd struct { |
| 15 | + cmd *cobra.Command |
| 16 | +} |
| 17 | + |
| 18 | +func (c *InstallCodesphereCmd) RunE(_ *cobra.Command, args []string) error { |
| 19 | + //Command execution goes here |
| 20 | + |
| 21 | + fmt.Printf("running %s", c.cmd.Use) |
| 22 | + |
| 23 | + return nil |
| 24 | +} |
| 25 | + |
| 26 | +func AddInstallCodesphereCmd(install *cobra.Command) { |
| 27 | + codesphere := InstallCodesphereCmd{ |
| 28 | + cmd: &cobra.Command{ |
| 29 | + Use: "codesphere", |
| 30 | + Short: "A brief description of your command", |
| 31 | + Long: `A longer description that spans multiple lines and likely contains examples |
| 32 | +and usage of using your command. For example: |
| 33 | +
|
| 34 | +Cobra is a CLI library for Go that empowers applications. |
| 35 | +This application is a tool to generate the needed files |
| 36 | +to quickly create a Cobra application.`, |
| 37 | + }, |
| 38 | + } |
| 39 | + // Here you will define your flags and configuration settings. |
| 40 | + |
| 41 | + // Cobra supports Persistent Flags which will work for this command |
| 42 | + // and all subcommands, e.g.: |
| 43 | + // codesphere.cmd.PersistentFlags().String("foo", "", "A help for foo") |
| 44 | + |
| 45 | + // Cobra supports local flags which will only run when this command |
| 46 | + // is called directly, e.g.: |
| 47 | + // codesphere.cmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") |
| 48 | + install.AddCommand(codesphere.cmd) |
| 49 | + codesphere.cmd.RunE = codesphere.RunE |
| 50 | + |
| 51 | + // Add child commands here |
| 52 | + // AddCodesphereChildCmd(codesphere.cmd) |
| 53 | +} |
| 54 | + |
0 commit comments