Skip to content

Commit 23d427a

Browse files
committed
feat(setup): automatic fill cli name on setup
1 parent 5307084 commit 23d427a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

setup/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ func main() {
3737
project.ProjectURL = pterm.Sprintf("github.com/%s/%s", project.Username, project.Reponame)
3838
project.ProjectName = pterm.Sprintf("%s/%s", project.Username, project.Reponame)
3939

40-
const cliTemplateURL = "pterm/cli-template"
41-
42-
pterm.Info.Printfln("Replacing all '%s' with %s", pterm.Magenta(cliTemplateURL), pterm.Magenta(project.ProjectName))
40+
const cliTemplatePath = "pterm/cli-template"
41+
pterm.Info.Printfln("Replacing all '%s' with %s", pterm.Magenta(cliTemplatePath), pterm.Magenta(project.ProjectName))
4342
walkOverExt("go,mod", func(path string) {
44-
pterm.Debug.Printfln("Replacing '%s' in %s with %s", pterm.Magenta(cliTemplateURL), path, pterm.Magenta(project.ProjectName))
45-
replaceAllInFile(path, cliTemplateURL, project.ProjectName)
43+
pterm.Debug.Printfln("Replacing '%s' in %s with %s", pterm.Magenta(cliTemplatePath), path, pterm.Magenta(project.ProjectName))
44+
replaceAllInFile(path, cliTemplatePath, project.ProjectName)
4645
})
4746

47+
replaceAllInFile("./cmd/root.go", `Use: "cli-template",`, pterm.Sprintf(`Use: "%s",`, project.Reponame))
48+
4849
pterm.Fatal.PrintOnError(os.Remove(getPathTo("./README.md")))
4950
pterm.Fatal.PrintOnError(os.Rename(getPathTo("./README.template-setup.md"), getPathTo("./README.template.md")))
5051
}

0 commit comments

Comments
 (0)