Skip to content

Make error message for bad options more descriptive. #601

Closed
@ntc2

Description

@ntc2

If I give a bad option or combination of options to stack it just prints the usage, without telling me what the problem is. It should tell me what it doesn't like about my options.

For example, I'm trying to figure out the stack test equivalent of cabal test --test-option=<op1> --test-option=<op2>. Looking at stack test --help I see the --test-arguments option. First I try

stack test --test-argument=<op1> --test-argument=<op2>

and stack prints a generic Usage: ... message without any hint about what is wrong.

The problem is that the option is called --test-arguments (plural), not --test-argument (singular); Stack should tell me what the problem is: the option I gave is unknown (bonus points for suggesting the correct option like GHC does with typoed symbols, but that's a fancier fix).

I then wonder if I'm only allowed to use the --test-argument option once and try

stack test --test-argument=<op1>

and stack says Usage: .... Again, I have no idea what I've done wrong.

I then realize I was supposed to write --test-arguments, plural, so I try

stack test --test-arguments=<op1>

which works. So, I try two arguments again with

stack test --test-arguments=<op1> --test-arguments=<op2>

and stack says Usage: .... The problem now is that I'm not allowed to specify --test-arguments twice; Stack should tell me this.

Finally, I try the correct

stack test --test-arguments='<op1> <op2>'

and the test runs :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions