better message when the command line arguments are incorrect #688

Closed
wants to merge 3 commits into
from

Projects

None yet

6 participants

@JordiPolo

Currently we let the exception from OptionParser to propagate, is difficult to read and ugly.

Member

I like this, except I think this should use abort(msg) rather than puts + exit(false)

Owner

except I think this should use abort(msg) rather than puts + exit(false)

Yep, that'd be good.

It'd also be good to add a spec for this; I think it'd work well to use a simpol mock expectation:

parser = Parser.new
parser.should_receive(:abort).with(/use --help/)
parse.parse!(some_invalid_args)
Contributor
Contributor

@JordiPolo, are you interested in writing the spec? If not, I'd be happy to run with your implementation and merge this in after adding one.

@alindeman alindeman was assigned Sep 26, 2012

@alindeman Yes, I gonna update this PR with your suggestions and the spec

I think I have addressed the issues. Thank you for your advise. I was unaware of the Kernel.abort method.

@alindeman alindeman closed this in ccedfcb Sep 28, 2012
Contributor

Thank you @JordiPolo 🌈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment