工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
497 B

4 years ago
  1. package servicegen
  2. import (
  3. "github.com/spf13/cobra"
  4. "log"
  5. )
  6. func Command() *cobra.Command {
  7. newCmd := &cobra.Command{
  8. Use: "new [string to new]",
  9. Short: "create service for hasaki",
  10. Args: cobra.MinimumNArgs(1),
  11. Run: func(cmd *cobra.Command, args []string) {
  12. err := Gen(args[0])
  13. if err != nil {
  14. log.Printf("Error: %+v\n", err)
  15. }
  16. },
  17. }
  18. serviceCmd := &cobra.Command{
  19. Use: "service",
  20. Short: "service command"}
  21. serviceCmd.AddCommand(newCmd)
  22. return serviceCmd
  23. }