diff --git a/cmd/init.go b/cmd/init.go index b518075..79c7c5d 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -6,6 +6,7 @@ package cmd import ( "os" + "os/exec" "path/filepath" "strings" @@ -145,7 +146,7 @@ func runInitAction(cmd *cobra.Command, args []string) { log.Debugf("Our project directory path is: %s", projectDirPath) // create project directory - log.Debug("Creating project directory") + log.Infof("Creating project directory") dirCreated, err := helpers.CheckAndCreateDir(projectDirPath) if err != nil { @@ -158,15 +159,26 @@ func runInitAction(cmd *cobra.Command, args []string) { return } - // move to project directory + // Move to project directory. + log.Infof("Moving to the project directory: %s", userInput.ProjectDirectory) + err = os.Chdir(projectDirPath) if err != nil { log.Errorf("Fail to move to project directory. The following error happen: %s", err.Error()) return } - // XXX: - // git init - // create .gouick - // move templated file + // Execute git init. + log.Info("Initializing Git") + + gitinit := exec.Command("git", "init") + _, err = gitinit.Output() + if err != nil { + log.Errorf("Fail to git init. The following error happen: %s", err.Error()) + return + } + + log.Info("Creating gouick configuration file") + + log.Info("Creating API skeleton") }