Loading pkg/cmd/version.go +2 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import ( cli "github.com/spf13/cobra" "github.com/tmrts/tmplt/pkg/tmplt" "github.com/tmrts/tmplt/pkg/util/tlog" "github.com/tmrts/tmplt/pkg/util/validate" ) Loading @@ -15,6 +16,6 @@ var Version = &cli.Command{ Run: func(_ *cli.Command, args []string) { MustValidateArgs(args, []validate.Argument{}) fmt.Println("Current version is", tmplt.Version) tlog.Info(fmt.Sprint("Current version is ", tmplt.Version)) }, } pkg/host/github.go +1 −0 Original line number Diff line number Diff line Loading @@ -10,5 +10,6 @@ func ZipURL(url string) string { return url } // BUG filepath.Join trims slashes use url.Join return "https://codeload.github.com/" + url + "/zip/master" } pkg/prompt/scan.go +3 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ import ( const ( // TODO align brackets used in the prompt message PromptFormatMessage = "[?] Please choose a value for %#q [default: %#v]: " PromptChoiceFormatMessage = "[?] Please select an option for %#q\n%v Select from %v..%v [default: %#v]: " PromptChoiceFormatMessage = "[?] Please choose an option for %#q\n%v Select from %v..%v [default: %#v]: " ) func scanLine() (string, error) { Loading Loading @@ -156,6 +156,7 @@ func newSlice(name string, choices []string) func() interface{} { // user input and has a default value that returns result. func New(name string, defval interface{}) func() interface{} { // TODO use reflect package // TODO add a prompt as such "How many Items will you enter", "Enter each" use in "{{range Items}}" switch defval := defval.(type) { case bool: return newBool(name, defval) Loading pkg/util/tlog/log.go +2 −0 Original line number Diff line number Diff line Loading @@ -49,3 +49,5 @@ func Error(msg string) { func Fatal(msg string) { Error(msg) } // TODO use dependency injection wrapper for fmt.Print usage in the code base pkg/util/validate/pattern/pattern_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ func TestUnixPathPattern(t *testing.T) { {"/tmp-dir", true}, {"/tmp-dir/new_dir", true}, {"/TMP/dir", true}, {"rel/dir", true}, } for _, test := range tests { Loading Loading
pkg/cmd/version.go +2 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import ( cli "github.com/spf13/cobra" "github.com/tmrts/tmplt/pkg/tmplt" "github.com/tmrts/tmplt/pkg/util/tlog" "github.com/tmrts/tmplt/pkg/util/validate" ) Loading @@ -15,6 +16,6 @@ var Version = &cli.Command{ Run: func(_ *cli.Command, args []string) { MustValidateArgs(args, []validate.Argument{}) fmt.Println("Current version is", tmplt.Version) tlog.Info(fmt.Sprint("Current version is ", tmplt.Version)) }, }
pkg/host/github.go +1 −0 Original line number Diff line number Diff line Loading @@ -10,5 +10,6 @@ func ZipURL(url string) string { return url } // BUG filepath.Join trims slashes use url.Join return "https://codeload.github.com/" + url + "/zip/master" }
pkg/prompt/scan.go +3 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ import ( const ( // TODO align brackets used in the prompt message PromptFormatMessage = "[?] Please choose a value for %#q [default: %#v]: " PromptChoiceFormatMessage = "[?] Please select an option for %#q\n%v Select from %v..%v [default: %#v]: " PromptChoiceFormatMessage = "[?] Please choose an option for %#q\n%v Select from %v..%v [default: %#v]: " ) func scanLine() (string, error) { Loading Loading @@ -156,6 +156,7 @@ func newSlice(name string, choices []string) func() interface{} { // user input and has a default value that returns result. func New(name string, defval interface{}) func() interface{} { // TODO use reflect package // TODO add a prompt as such "How many Items will you enter", "Enter each" use in "{{range Items}}" switch defval := defval.(type) { case bool: return newBool(name, defval) Loading
pkg/util/tlog/log.go +2 −0 Original line number Diff line number Diff line Loading @@ -49,3 +49,5 @@ func Error(msg string) { func Fatal(msg string) { Error(msg) } // TODO use dependency injection wrapper for fmt.Print usage in the code base
pkg/util/validate/pattern/pattern_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ func TestUnixPathPattern(t *testing.T) { {"/tmp-dir", true}, {"/tmp-dir/new_dir", true}, {"/TMP/dir", true}, {"rel/dir", true}, } for _, test := range tests { Loading