From 94887aae9e24f270766df97eca19d76095dfdfa9 Mon Sep 17 00:00:00 2001 From: David Allen Date: Fri, 29 Aug 2025 22:39:49 -0600 Subject: [PATCH] fix: panic with using init cmd --- cmd/init.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/init.go b/cmd/init.go index 31c9e9a..1bac85d 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -10,28 +10,29 @@ var initCmd = &cobra.Command{ Use: "init", Example: ` # create default files and directories at specified root path + # (must be set with positional argument) makeshift init $MAKESHIFT_ROOT `, 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 + server = service.New() + server.RootPath = args[0] err = server.Init() if err != nil { log.Error().Err(err). - Str("root", rootPath). + Str("root", server.RootPath). Msg("failed to initialize server root") return } log.Debug(). - Str("root", rootPath). + Str("root", server.RootPath). Msg("initialize makeshift files at root path") }, }