feat: add init command, needs functionality

This commit is contained in:
Allyedge
2022-05-29 20:13:43 +02:00
parent 321b537a4d
commit b8dfa6891a
3 changed files with 19 additions and 1 deletions

16
cmd/cli/init.go Normal file
View File

@@ -0,0 +1,16 @@
package cli
import (
"fmt"
"github.com/spf13/cobra"
)
var initCmd = &cobra.Command{
Use: "init",
Short: "Initialize a new Sern project.",
Long: `Initialize a new Sern project, either with a JavaScript or a TypeScript template.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Sern CLI - Init")
},
}

View File

@@ -20,6 +20,7 @@ func Execute() {
rootCmd.Flags().BoolP("help", "h", false, "Help for the Sern CLI.")
rootCmd.Flags().BoolP("version", "v", false, "The version of the Sern CLI.")
rootCmd.SetVersionTemplate("Sern CLI - Version {{.Version}}\n")
rootCmd.AddCommand(initCmd)
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)

3
go.mod
View File

@@ -2,8 +2,9 @@ module github.com/sern-handler/cli
go 1.18
require github.com/spf13/cobra v1.4.0
require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/cobra v1.4.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)