You can clone with
HTTPS or Subversion.
As discussed in #1088, cabal run currently requires separating the executable's options from run flags with --:
$ cabal run foo -- -bar baz
./dist/build/foo/foo -bar baz
$ cabal run foo -bar baz
Unrecognized option: -bar
It would be nice to make the -- optional while still allowing passing options (e.g. --env-var) to run itself. One way to implement this is to treat all input after and including the first unrecognised option as executable's options. However, making this work seems to require modifying both Distribution.Simple.Command and Distribution.GetOpt.
Assigning this to myself so that I don't forget about the issue.
Why not require that flags to run come before the executable name, and then any arguments after it are treated as executable flags? You'd still need -- to run the "default" executable without naming it but I think that's sensible.
I think this is already a distinction cabal-install does with global vs command-specific flags, e.g. cabal --numeric-version install works but not cabal install --numeric-version. With my suggestion, the executable name becomes a sub-command of the run command, of sorts.
cabal --numeric-version install
cabal install --numeric-version
This requires reworking the way we parse options. E.g. there is no direct support for subcommands (#1257), which is why all cabal sandbox subcommands accept --snapshot, instead of only add-source.
What @23Skidoo said. It's a limitation in how getopt works.