-
Notifications
You must be signed in to change notification settings - Fork 696
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
Provide a run command #1088
Comments
Please let me know if this would be accepted. Normally I'd just start hacking, but after the #2 disaster I'd rather not spend any time on that only to get it bikeshedded to death. |
I think it's a good idea. @dcoutts? |
I've argued for this feature in the past. |
I suggest that |
@tibbe Why is that better than the original proposal ( |
@23Skidoo That would work as long as the component name is mandatory? How would you otherwise tell it apart from an argument? Perhaps it's better to just have |
Yes, I would prefer to make the component mandatory. |
I'm fine with that. |
If there are extra arguments provided, always treat the first one as the component name. If |
Would the |
I am not even sure we want |
@23Skidoo Would that mean, that |
I didn't follow your last comment. Are you saying that we will only forward flag (i.e. |
Sorry, I should have explained it better. If the If there is only one executable:
If there is more than one executable:
|
On the other hand, if |
Personally I think that if there is an executable That also spares us from
If we want to make it more convenient for the user, we could put our effort into the bash completion script, and let it complete command names. |
But if the name of the executable is the same as the value of an argument, it becomes ambiguous. We can solve that by disallowing the executable name part if there's only one executable defined, but then the user needs to look up the number of executable to know if she can use the longer I think we shouldn't exclude the possibility of then |
Since this case is likely to be rare, we can require the user to be more explicit here. For example, in the single executable case:
And if there are multiple executables, specifying the component name will be required.
Yes, |
@23Skidoo Can you formalize the rules for parsing |
If we agree that the form
|
@sol Right. (1) is easy to define (as the executable name is mandatory). (2) is what we need to define, with the side condition that nothing in (2) can invalidate anything in (1). |
I need to look more closely into how Cabal's option parsing works for that. |
Right now No matter how this is implemented,
|
I've thought about this too. I see two reasonable alternatives:
In relation to the issue of making the exe name mandatory or not, I don't have a strong opinion. I should note that it'd be good if we can make the ui here similar to what we're planning for cabal build which is |
As a side note: |
@23Skidoo How will the change to If we don't change
instead of
? I think so. |
I think that it can be implemented similarly to |
Before I forget, we also need |
Is anyone against settling on the conceptually simple (i.e. no changes to
? I think the need to not change how command parsing works somehow shows that this version will also be more intuitive for users. |
I like the ability to omit |
We could go with a mandatory |
I didn't really follow the discussion. So just to be sure, would that only affect situations where the user omits the component name? Say would
still work? |
@sol No, it will complain about the unrecognised option |
I hacked together an initial implementation of |
See the discussion in haskell#1088.
Do we want to make |
Personally, I think it would be nice. |
I'm not sure whether we want to make |
Hm, not sure. If you explicitly mention the component as in
I think it's odd if you have to type |
Well, you'll still have to type |
You don't, if you define the syntax to be:
|
@sol You can't make this syntax work without modifying |
Closing this ticket since |
I propose to add a
run
command tocabal-install
, that can be used to build and run executables.Details
If I have a cabal file with an
executable
section forfoo
, then running$ cabal run foo
should build
foo
, if necessary, and run it. It should have the same effect as:$ cabal build && ./dist/build/foo/foo
If I provide additional arguments to
cabal run
they are just passed though, e.g.$ cabal run foo arg1 arg2
should have the same effect as:
$ cabal build && ./dist/build/foo/foo arg1 arg2
The text was updated successfully, but these errors were encountered: