Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This will create a doth.yaml file with the provided configuration, and a modules
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.DothShWrapperTemplate), "doth.sh wrapper script", 0744))
AddModule(model.NewCreateFileStepWithPermissions(model.DothShWrapperLocation, []byte(model.DothShWrapper), "doth.sh wrapper script", 0744))

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

Expand Down
25 changes: 25 additions & 0 deletions cmd/wrapper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright © 2026 NAME HERE <EMAIL ADDRESS>
*/
package cmd

import (
"fmt"

"github.com/5000K/doth/model"
"github.com/spf13/cobra"
)

// wrapperCmd represents the wrapper command
var wrapperCmd = &cobra.Command{
Use: "wrapper",
Short: "Prints the current version of the wrapper into stdout.",
Long: `Prints the current version of the wrapper into stdout.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(model.DothShWrapper)
},
}

func init() {
rootCmd.AddCommand(wrapperCmd)
}
2 changes: 1 addition & 1 deletion model/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var DothFileTemplate string
const DothShWrapperLocation = "./doth.sh"

//go:embed constants/doth.sh
var DothShWrapperTemplate string
var DothShWrapper string

const GitignoreFileLocation = "./.gitignore"

Expand Down
4 changes: 4 additions & 0 deletions model/constants/doth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ setup_doth() {
echo "Installing the current version of doth..."
NEW_VERSION=$(curl -Ls https://github.com/5000K/doth/releases/latest/download/version.txt)
${GO_COMMAND} install github.com/5000K/doth@$NEW_VERSION
doth wrapper > "$0"
}

check_doth_version() {
Expand All @@ -66,6 +67,9 @@ check_doth_version() {
chmod -R u+w ${GOPATH_FOLDER}/**
rm -rf ${GOPATH_FOLDER}
${GO_COMMAND} install github.com/5000K/doth@$NEW_VERSION
echo "Updating wrapper script..."
doth wrapper > "$0"
chmod +x "$0"
fi
}

Expand Down
Loading