Skip to content

Pass args after -- to the executable during run and serve #4212

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ealmloff
Copy link
Member

@ealmloff ealmloff commented May 27, 2025

You can pass args to the executable(s) opened by dx after a trailing -- just like cargo run:

dx serve -- arg1 arg2
dx run -- arg1 arg2

Fixes #4122

@ealmloff ealmloff requested a review from a team as a code owner May 27, 2025 18:36
@ealmloff ealmloff added bug Something isn't working cli Related to the dioxus-cli program labels May 27, 2025
@rami3l
Copy link

rami3l commented Jun 2, 2025

@ealmloff Many thanks for the patch! I've tried it locally on my project and it works pretty well without issues. Is there any remaining blocker preventing this from being merged?

@jkelleyrtp
Copy link
Member

jkelleyrtp commented Jun 3, 2025

We added support for multi-platform serve:

dx serve \
  @client --package dashboard \
  @server --package server

How does this PR interact the multi-target builds? It seems like we can only pass args to the final target?

@ealmloff
Copy link
Member Author

ealmloff commented Jun 4, 2025

We added support for multi-platform serve:

dx serve \
  @client --package dashboard \
  @server --package server

How does this PR interact the multi-target builds? It seems like we can only pass args to the final target?

Currently, it passes args to both binaries if you serve desktop + fullstack. It looks like subcommand_precedence_over_arg in the subcommand doesn't see through the -- args. This command doesn't work dx serve -- args @client ... @server .... I would like to support something like this:

dx serve -- shared args @client -- client args @server -- server args 

It might require parsing more stuff manually without clap. We also currently only allow separate build args for the client and server, not serve args like --open and we don't handle merging shared args with the separate args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the dioxus-cli program
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing --args to dx serve shouldn't be a no-op
3 participants