Skip to content

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 --args "arg1 arg2"
dx run --args "arg1 arg2"

Fixes #4122
Fixes #4250

@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

@ealmloff ealmloff changed the title Pass args after -- to the executable during run and serve Fix --args and handle merging in @server and @client Jun 10, 2025
@ealmloff
Copy link
Member Author

I couldn't find a good way to get the last argument working with subcommand, so I switched back to a string args. You can now do dx serve @client --args "foo" @server --args "bar"

@client and @server also handle merging args and work with serve args where it makes sense to do so

@rami3l
Copy link

rami3l commented Jun 16, 2025

@ealmloff Many thanks again! I have updated my local build to match b70e60b and can confirm the new syntax is indeed working in my case.

Is there anything I could do to help this PR get merged? Thanks in advance!

@jkelleyrtp jkelleyrtp merged commit 3bf8f09 into DioxusLabs:main Jun 18, 2025
18 of 19 checks passed
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.

Assets are not served with Web + fullstack on workspace (0.7.0-alpha.1) Passing --args to dx serve shouldn't be a no-op

3 participants