haskell / haskell/cabal

Allow omitting the double dash when running `cabal run`

Open
#1,119 7 comments 0 reactions 0 assignees View on GitHub
cabal-install: cmd/run status: consider closing type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

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`.

Contributor guide

Open the contributing guide

Research direction

Start by reading Distribution.Simple.Command and Distribution.GetOpt, the two parsing areas named in the issue, and compare how cabal run handles options before and after --. Done means executable options such as -bar and --env-var are correctly distinguished without requiring --, while explicit -- continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.