From 325f77b9d4d665c6047476ba7e532d905597f425 Mon Sep 17 00:00:00 2001 From: David Allen Date: Fri, 29 Aug 2025 22:33:07 -0600 Subject: [PATCH] feat: added init cmd implementation --- cmd/init.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cmd/init.go b/cmd/init.go index e064ed0..31c9e9a 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -1,6 +1,10 @@ package cmd -import "github.com/spf13/cobra" +import ( + "git.towk2.me/towk/makeshift/pkg/service" + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" +) var initCmd = &cobra.Command{ Use: "init", @@ -11,10 +15,27 @@ var initCmd = &cobra.Command{ Args: cobra.ExactArgs(1), Short: "Initialize directory with default files", Run: func(cmd *cobra.Command, args []string) { + var ( + rootPath, _ = cmd.Flags().GetString("root") + server *service.Service + err error + ) + + // create the server root files and directories + err = server.Init() + if err != nil { + log.Error().Err(err). + Str("root", rootPath). + Msg("failed to initialize server root") + return + } + log.Debug(). + Str("root", rootPath). + Msg("initialize makeshift files at root path") }, } func init() { - + rootCmd.AddCommand(initCmd) }