From c7654dbb16566d36d3c49e0ec936377dbad4851d Mon Sep 17 00:00:00 2001 From: Sean Fairchild Date: Wed, 29 Aug 2018 13:05:12 -0400 Subject: [PATCH 1/5] Update error message for submision of directory --- cmd/submit.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/submit.go b/cmd/submit.go index 9952b5fdb..8d5b006b2 100644 --- a/cmd/submit.go +++ b/cmd/submit.go @@ -87,6 +87,8 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error { %s + Please provide the path to the file you wish to submit, e.g. : exercism submit FILENAME + ` return fmt.Errorf(msg, arg) } From 91088b8567fd67ffcdedb5bbd1f3d1c6b9db3a72 Mon Sep 17 00:00:00 2001 From: Sean Fairchild Date: Wed, 29 Aug 2018 13:11:00 -0400 Subject: [PATCH 2/5] Update test to check for helpful error --- cmd/submit_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/submit_test.go b/cmd/submit_test.go index 556c3d390..2fe0098e6 100644 --- a/cmd/submit_test.go +++ b/cmd/submit_test.go @@ -123,6 +123,7 @@ func TestSubmitFilesAndDir(t *testing.T) { } err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files) assert.Regexp(t, "submitting a directory", err.Error()) + assert.Regexp(t, "Please provide the path to the file you wish to submit", err.Error()) } func TestSubmitFiles(t *testing.T) { From 2c58245475b0261979f0697756e893f50af9476d Mon Sep 17 00:00:00 2001 From: Sean Fairchild Date: Wed, 29 Aug 2018 16:02:42 -0400 Subject: [PATCH 3/5] Updating message format to use BinaryName --- cmd/submit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/submit.go b/cmd/submit.go index 8d5b006b2..101f5eb03 100644 --- a/cmd/submit.go +++ b/cmd/submit.go @@ -87,10 +87,10 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error { %s - Please provide the path to the file you wish to submit, e.g. : exercism submit FILENAME + Please provide the path to the file you wish to submit, e.g. : %s submit FILENAME ` - return fmt.Errorf(msg, arg) + return fmt.Errorf(msg, arg, BinaryName) } src, err := filepath.EvalSymlinks(arg) From 7c03f2884791c6106d7b1d2225ee3cb46fd6e26f Mon Sep 17 00:00:00 2001 From: Sean Fairchild Date: Thu, 30 Aug 2018 15:48:25 -0400 Subject: [PATCH 4/5] Update error message format further --- cmd/submit.go | 4 +++- cmd/submit_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/submit.go b/cmd/submit.go index 101f5eb03..29d7eb440 100644 --- a/cmd/submit.go +++ b/cmd/submit.go @@ -87,7 +87,9 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error { %s - Please provide the path to the file you wish to submit, e.g. : %s submit FILENAME + Please change into the directory and provide the path to the file(s) you wish to submit + + %s submit FILENAME ` return fmt.Errorf(msg, arg, BinaryName) diff --git a/cmd/submit_test.go b/cmd/submit_test.go index 2fe0098e6..2b9169fe4 100644 --- a/cmd/submit_test.go +++ b/cmd/submit_test.go @@ -123,7 +123,7 @@ func TestSubmitFilesAndDir(t *testing.T) { } err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files) assert.Regexp(t, "submitting a directory", err.Error()) - assert.Regexp(t, "Please provide the path to the file you wish to submit", err.Error()) + assert.Regexp(t, "Please change into the directory and provide the path to the file\(s\) you wish to submit", err.Error()) } func TestSubmitFiles(t *testing.T) { From 088037ad51c8d1caed0babe15495154aa88b5036 Mon Sep 17 00:00:00 2001 From: Sean Fairchild Date: Thu, 30 Aug 2018 15:57:17 -0400 Subject: [PATCH 5/5] Fix test by double escaping --- cmd/submit_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/submit_test.go b/cmd/submit_test.go index 2b9169fe4..ca1147e32 100644 --- a/cmd/submit_test.go +++ b/cmd/submit_test.go @@ -123,7 +123,7 @@ func TestSubmitFilesAndDir(t *testing.T) { } err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files) assert.Regexp(t, "submitting a directory", err.Error()) - assert.Regexp(t, "Please change into the directory and provide the path to the file\(s\) you wish to submit", err.Error()) + assert.Regexp(t, "Please change into the directory and provide the path to the file\\(s\\) you wish to submit", err.Error()) } func TestSubmitFiles(t *testing.T) {