New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack exec --help is invalid #806

Closed
Fuuzetsu opened this Issue Aug 17, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@Fuuzetsu
Contributor

Fuuzetsu commented Aug 17, 2015

Invalid option `--help'

Usage: stack exec CMD [-- ARGS (e.g. stack ghc -- X.hs -o x)] ([--plain] |
                  ([--ghc-package-path] | [--no-ghc-package-path])
                  ([--stack-exe] | [--no-stack-exe]) [--package ARG])
  Execute a command
@borsboom

This comment has been minimized.

Contributor

borsboom commented Aug 18, 2015

Would you mind being more specific about what is incorrect? I do see the (e.g. stack ghc -- X.hs -o x) is more relevant for another command, is there anything else?

@chrisdone

This comment has been minimized.

Member

chrisdone commented Aug 18, 2015

I think he means the fact that --help says "invalid option --help". I don't know why optparse-applicative does this.

@Fuuzetsu

This comment has been minimized.

Contributor

Fuuzetsu commented Aug 19, 2015

Yes, what Chris said.

@chrisdone

This comment has been minimized.

Member

chrisdone commented Aug 19, 2015

I found while writing stack new that I can add a --help option manually, as here, but it seems like this shouldn't be necessary. We could, at least, add this to addCommand automatically. Although it feels like optparse should probably have some non-manual way of enabling this.

@borsboom borsboom added this to the Options parsing milestone Aug 23, 2015

@borsboom

This comment has been minimized.

Contributor

borsboom commented Aug 23, 2015

That's very strange, other subcommands seem to have working --help without adding it manually. And optparse-simple's addCommand use a parser which adds a --help option just like the one you add manually for stack new. Probably chalk this down to another bizarre argument-order/subcommand-related behaviour in optparse-applicative.

@snoyberg snoyberg self-assigned this Sep 2, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 2, 2015

This is definitely buggy behavior, I was bitten by this a bit ago and got curious. I'm preparing a PR with an ugly hack that solves it, though the usability downside makes me nervous about just committing to master.

snoyberg added a commit that referenced this issue Sep 2, 2015

Hacky workaround for optparse-applicative issue with stack exec --help (
fixes #806)

Downside: usage information now looks like:

Usage: stack exec [CMD -- ARGS (e.g. stack ghc -- X.hs -o x)]

Notice how "CMD" is inside the square brackets. Still seems like a
worthwhile tradeoff to me.

@snoyberg snoyberg added the in progress label Sep 2, 2015

snoyberg added a commit that referenced this issue Sep 2, 2015

Hacky workaround for optparse-applicative issue with stack exec --help (
fixes #806)

Downside: usage information now looks like:

Usage: stack exec [CMD -- ARGS (e.g. stack ghc -- X.hs -o x)]

Notice how "CMD" is inside the square brackets. Still seems like a
worthwhile tradeoff to me.
@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 2, 2015

See PR #903

@borsboom borsboom closed this in #903 Sep 2, 2015

@snoyberg snoyberg removed the in progress label Sep 2, 2015

@borsboom borsboom reopened this Sep 2, 2015

@snoyberg snoyberg removed their assignment Sep 3, 2015

@snoyberg snoyberg added the in progress label Sep 3, 2015

@borsboom borsboom modified the milestones: Options parsing, P3 Sep 12, 2015

@borsboom borsboom closed this in b265f80 Oct 31, 2015

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