Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ This will create a doth.yaml file with the provided configuration, and a modules
return
}

wrapper, err := cmd.Flags().GetBool("wrapper")
if err != nil {
fmt.Printf("Error getting wrapper flag: %v\n", err)
return
}

modulesDir, err := cmd.Flags().GetString("modules")
if err != nil {
fmt.Printf("Error getting modules flag: %v\n", err)
Expand All @@ -60,8 +66,11 @@ This will create a doth.yaml file with the provided configuration, and a modules
AddModule(model.NewCreateDirStep(modulesDir, "modules directory")).
AddModule(model.NewCreateDirStep(model.LocalStateDir, "local state directory")).
AddModule(model.NewCreateFileStep(model.DothFileLocation, []byte(model.DothFileTemplate), "default configuration file")).
AddModule(model.NewCreateFileStep(model.GitignoreFileLocation, []byte(model.GitignoreFileTemplate), "default .gitignore file")).
AddModule(model.NewCreateFileStepWithPermissions(model.DothShWrapperLocation, []byte(model.DothShWrapper), "doth.sh wrapper script", 0744))
AddModule(model.NewCreateFileStep(model.GitignoreFileLocation, []byte(model.GitignoreFileTemplate), "default .gitignore file"))

if wrapper {
pipeline.AddModule(model.NewCreateFileStepWithPermissions(model.DothShWrapperLocation, []byte(model.DothShWrapper), "doth.sh wrapper script", 0744))
}

err = pipeline.Run(dry, verbose, config)

Expand All @@ -81,4 +90,5 @@ func init() {
initCmd.Flags().BoolP("verbose", "v", false, "Print verbose output when running commands")
initCmd.Flags().Bool("destructive", false, "Deletes and recreates the whole project. This should be used with caution")
initCmd.Flags().BoolP("autoconfirm", "y", false, "Automatically confirm all prompts with 'yes'")
initCmd.Flags().BoolP("wrapper", "w", false, "Output a .sh wrapper script for doth (automatically sets up and updates everything)")
}