38 lines
754 B
Go
38 lines
754 B
Go
/*
|
|
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
|
*/
|
|
package cmd
|
|
|
|
import (
|
|
"git.andreafazzi.eu/andrea/probo/cmd/util"
|
|
"git.andreafazzi.eu/andrea/probo/embed"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// initCmd represents the init command
|
|
var initCmd = &cobra.Command{
|
|
Use: "init",
|
|
Short: "Initialize a working directory",
|
|
Long: util.RenderMarkdownTemplates("cli/*.tmpl", "cli/init/*.tmpl"),
|
|
Run: runInit,
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(initCmd)
|
|
}
|
|
|
|
func runInit(cmd *cobra.Command, args []string) {
|
|
err := embed.CopyToWorkingDirectory(embed.Data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
err = embed.CopyToWorkingDirectory(embed.Templates)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
err = embed.CopyToWorkingDirectory(embed.Public)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
}
|