Skip to content

Commit c31cddb

Browse files
author
Alessandro Baffa
committed
add check if the submitted filename is a directory
update the error message considering that the user can update more than one file.
1 parent efa5490 commit c31cddb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cmd/submit.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/codegangsta/cli"
1010
"github.com/exercism/cli/api"
1111
"github.com/exercism/cli/config"
12+
"github.com/exercism/cli/paths"
1213
)
1314

1415
// Submit posts an iteration to the API.
@@ -60,6 +61,10 @@ func Submit(ctx *cli.Context) {
6061
log.Fatal("You cannot submit the README as a solution.")
6162
}
6263

64+
if paths.IsDir(filename) {
65+
log.Fatal("Please specify each file that should be submitted, e.g. `exercism submit file1 file2 file3`.")
66+
}
67+
6368
file, err := filepath.Abs(filename)
6469
if err != nil {
6570
log.Fatal(err)

0 commit comments

Comments
 (0)