2022-06-14 12:40:00 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func newCodeCmd() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "code",
|
|
|
|
Short: "Generate code",
|
|
|
|
RunE: codeRunE,
|
2022-09-01 02:24:47 +00:00
|
|
|
|
|
|
|
DisableAutoGenTag: true,
|
2022-06-14 12:40:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cmd.AddCommand(newCodeKeysCmd())
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func codeRunE(cmd *cobra.Command, args []string) (err error) {
|
|
|
|
for _, subCmd := range cmd.Commands() {
|
|
|
|
switch {
|
|
|
|
case subCmd.RunE != nil:
|
|
|
|
if err = subCmd.RunE(subCmd, args); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
case subCmd.Run != nil:
|
|
|
|
subCmd.Run(subCmd, args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|