Skip to content

Conversation

@jimmyhmiller
Copy link

When I wrote a program using --help, I found that cabin would always intercept it when doing cabin run --help. So following cargo's lead, I added -- to separate them. So now you can run cabin run -- --help and it passes help to your program. I didn't remove the old functionality because I wasn't sure if you'd want that breaking change.

I figured the code here is easier to start the discussion hence the rfc pr.

@ken-matsui
Copy link
Member

Thanks, can you please write integration tests for this?

@jimmyhmiller
Copy link
Author

Written. Let me know if you want something else. The run test was pretty sparse.

@ken-matsui
Copy link
Member

Thanks, will take a look when I get a chance.

Copy link
Member

@ken-matsui ken-matsui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't remove the old functionality because I wasn't sure if you'd want that breaking change.

Does Cargo only have the behavior you added?

.addOpt(OPT_JOBS)
.setArg(Arg{ "args" }
.setDesc("Arguments passed to the program")
.setArg(Arg{ "[-- args]" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, is this the same as what Cargo prints? (I'm AFK)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't what they print, but it is how they document it. https://doc.rust-lang.org/cargo/commands/cargo-run.html If you do cargo help run, you will see the same. But the actually cargo run --help is less clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the help and totally agree. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check what the help looks like? Wouldn't it be like cabin run [OPTIONS] [[-- args]]...? I think we want something like cabin run [OPTIONS] [-- args...].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.setArg(Arg{ "[-- args]" }
.setArg(Arg{ "-- args..." }

IIRC, you can change .setVariadic(true) to false and add a TODO for me.

@jimmyhmiller
Copy link
Author

Does Cargo only have the behavior you added?

So cargo doesn't do what you are doing here with unknown args. I'd imagine, because that can lead to any new argument you add to run to be a breaking change. So you must be explicit and do the -- for program args. I'd personally recommend that. I'm happy to make the change and remove the test, but didn't want to make a breaking change (technically this is one but fairly small) without you being for it.

@jimmyhmiller
Copy link
Author

I believe everything has been addressed

@ken-matsui
Copy link
Member

Does Cargo only have the behavior you added?

So cargo doesn't do what you are doing here with unknown args. I'd imagine, because that can lead to any new argument you add to run to be a breaking change. So you must be explicit and do the -- for program args. I'd personally recommend that. I'm happy to make the change and remove the test, but didn't want to make a breaking change (technically this is one but fairly small) without you being for it.

Yeah, I think we have a good reason to have the breaking change. Can you remove the original behavior? Thanks!

@ken-matsui ken-matsui force-pushed the main branch 8 times, most recently from 0779bf5 to 837e3d4 Compare August 12, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants