(name string)
| 27 | ) |
| 28 | |
| 29 | func GetPkgCommand(name string) *cobra.Command { |
| 30 | pkg := &cobra.Command{ |
| 31 | Use: "pkg", |
| 32 | Short: pkgdocs.PkgShort, |
| 33 | Long: pkgdocs.PkgLong, |
| 34 | Example: pkgdocs.PkgExamples, |
| 35 | Aliases: []string{"package"}, |
| 36 | RunE: func(cmd *cobra.Command, args []string) error { |
| 37 | h, err := cmd.Flags().GetBool("help") |
| 38 | if err != nil { |
| 39 | return err |
| 40 | } |
| 41 | if h { |
| 42 | return cmd.Help() |
| 43 | } |
| 44 | return cmd.Usage() |
| 45 | }, |
| 46 | } |
| 47 | pkg.AddCommand( |
| 48 | cmddesc.NewCommand(name), cmdget.NewCommand(name), cmdinit.NewCommand(name), |
| 49 | cmdfix.NewCommand(name), cmdsync.NewCommand(name), cmdupdate.NewCommand(name), cmddiff.NewCommand(name), |
| 50 | ) |
| 51 | return pkg |
| 52 | } |
no test coverage detected