Convert to Title Case

I am aware that this is a somewhat pointless dependency
I don't really care though, it's not *that* big!!
This commit is contained in:
comp500
2019-09-18 23:13:58 +01:00
parent 0d6dfe97f7
commit 2b12e2c390
3 changed files with 5 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ import (
"github.com/fatih/camelcase"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/igorsobreira/titlecase"
)
// initCmd represents the init command
@@ -45,7 +46,7 @@ var initCmd = &cobra.Command{
}
if directoryName != "." && len(directoryName) > 0 {
// Turn directory name into a space-seperated proper name
name = strings.ReplaceAll(strings.ReplaceAll(strings.Join(camelcase.Split(directoryName), " "), " - ", " "), " _ ", " ")
name = titlecase.Title(strings.ReplaceAll(strings.ReplaceAll(strings.Join(camelcase.Split(directoryName), " "), " - ", " "), " _ ", " "))
fmt.Print("Modpack name [" + name + "]: ")
} else {
fmt.Print("Modpack name: ")