Skip to content

Commit

Permalink
Create cobra command
Browse files Browse the repository at this point in the history
  • Loading branch information
toshinari123 committed Mar 5, 2024
1 parent 39f6423 commit e64e10f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/pageship/app/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package app

import (
"fmt"

"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(generateCmd)
generateCmd.AddCommand(generateDockerfileCmd)
}

var generateCmd = &cobra.Command{
Use: "generate [command]",
Short: "Generate files",
Args: cobra.NoArgs, //if unknown command, will return error just like main pageship command
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help() //show help if no subcommand supplied
return nil
},
}

var generateDockerfileCmd = &cobra.Command{
Use: "dockerfile",
Short: "Generate dockerfile",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("buh")
return nil
},
}

0 comments on commit e64e10f

Please sign in to comment.