Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ func Submit(ctx *cli.Context) {
log.Printf("file name: %s", filename)
}

if isTest(filename) {
log.Fatal("Please submit the solution, not the test file.")
if isTest(filename) && !ctx.Bool("test") {
log.Fatal("You're trying to submit a test file. If this is really what " +
"you want, please pass the --test flag to exercism submit.")
} else if !isTest(filename) && ctx.Bool("test") {
log.Fatal("You've passed the --test flag but you're not submitting a test file.")
}

file, err := filepath.Abs(filename)
Expand Down
6 changes: 6 additions & 0 deletions exercism/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ func main() {
ShortName: "s",
Usage: descSubmit,
Action: cmd.Submit,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "test",
Usage: "submit a test file",
},
},
},
{
Name: "unsubmit",
Expand Down