diff --git a/main.go b/main.go index f3c3d0c..f5da94c 100644 --- a/main.go +++ b/main.go @@ -131,6 +131,7 @@ func (cli *CLI) Run(_args []string) int { var camel = flag.Bool("camel", false, "Substitute (upper) camel-cased expressions") var upperCamel = flag.Bool("upper-camel", false, "Substitute upper-camel-cased expressions") var lowerCamel = flag.Bool("lower-camel", false, "Substitute lower-camel-cased expressions") + var screamingSnake = flag.Bool("screaming-snake", false, "Substitute screaming-snake-cased expressions") var all = flag.BoolP("all", "a", false, "Substitute (snake|kebab|camel)-cased expressions") var ruby = flag.Bool("ruby", false, "Substitute Ruby module and directory expressions") var rename = flag.BoolP("rename", "r", false, "Rename files with expression") @@ -180,6 +181,9 @@ func (cli *CLI) Run(_args []string) int { if *lowerCamel || *all { addSub(&substitutions, rawFrom, to, strcase.ToLowerCamel) } + if *screamingSnake { + addSub(&substitutions, rawFrom, to, strcase.ToScreamingSnake) + } if *ruby { addSub(&substitutions, rawFrom, to, ToRubyDirectory) diff --git a/main_test.go b/main_test.go index 7cde7d9..32b3a5b 100644 --- a/main_test.go +++ b/main_test.go @@ -180,15 +180,15 @@ func TestSubstitutionWithPath(t *testing.T) { func TestSubstitutionWithCaseConversion(t *testing.T) { RunInTmpRepo(func() { - CommitFile("README.md", "GitGsub git_gsub git-gsub") - _, err := RunGitGsub("--camel", "--kebab", "--snake", "git-gsub", "svn-gsub") + CommitFile("README.md", "GitGsub git_gsub git-gsub GIT_GSUB") + _, err := RunGitGsub("--camel", "--kebab", "--snake", "--screaming-snake", "git-gsub", "svn-gsub") if err != nil { t.Errorf("Command failed: %s", err) } dat, _ := ioutil.ReadFile("./README.md") - if string(dat) != "SvnGsub svn_gsub svn-gsub" { + if string(dat) != "SvnGsub svn_gsub svn-gsub SVN_GSUB" { t.Errorf("Failed: %s", string(dat)) } })