File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed
Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " tauri-cli " : patch
3+ " tauri.js " : patch
4+ ---
5+
6+ All the arguments passed after ` tauri dev -- ` are now propagated to the binary.
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ subcommands:
88 subcommands :
99 - dev :
1010 about : Tauri dev.
11+ setting : TrailingVarArg
1112 args :
1213 - config :
1314 short : c
@@ -18,6 +19,10 @@ subcommands:
1819 short : e
1920 long : exit-on-panic
2021 about : Exit on panic
22+ - args :
23+ about : Args passed to the binary
24+ index : 1
25+ multiple : true
2126 - build :
2227 about : Tauri build.
2328 args :
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ fn kill_before_dev_process() {
3232pub struct Dev {
3333 exit_on_panic : bool ,
3434 config : Option < String > ,
35+ args : Vec < String > ,
3536}
3637
3738impl Dev {
@@ -49,6 +50,11 @@ impl Dev {
4950 self
5051 }
5152
53+ pub fn args ( mut self , args : Vec < String > ) -> Self {
54+ self . args = args;
55+ self
56+ }
57+
5258 pub fn run ( self ) -> crate :: Result < ( ) > {
5359 let logger = Logger :: new ( "tauri:dev" ) ;
5460 let tauri_path = tauri_dir ( ) ;
@@ -149,6 +155,9 @@ impl Dev {
149155 fn start_app ( & self , child_wait_rx : Arc < Mutex < Receiver < ( ) > > > ) -> Arc < SharedChild > {
150156 let mut command = Command :: new ( "cargo" ) ;
151157 command. args ( & [ "run" , "--no-default-features" ] ) ;
158+ if !self . args . is_empty ( ) {
159+ command. arg ( "--" ) . args ( & self . args ) ;
160+ }
152161 let child = SharedChild :: spawn ( & mut command) . expect ( "failed to run cargo" ) ;
153162 let child_arc = Arc :: new ( child) ;
154163
Original file line number Diff line number Diff line change @@ -80,8 +80,12 @@ fn init_command(matches: &ArgMatches) -> Result<()> {
8080fn dev_command ( matches : & ArgMatches ) -> Result < ( ) > {
8181 let exit_on_panic = matches. is_present ( "exit-on-panic" ) ;
8282 let config = matches. value_of ( "config" ) ;
83+ let args: Vec < String > = matches
84+ . values_of ( "args" )
85+ . map ( |a| a. into_iter ( ) . map ( |v| v. to_string ( ) ) . collect ( ) )
86+ . unwrap_or_default ( ) ;
8387
84- let mut dev_runner = dev:: Dev :: new ( ) . exit_on_panic ( exit_on_panic) ;
88+ let mut dev_runner = dev:: Dev :: new ( ) . exit_on_panic ( exit_on_panic) . args ( args ) ;
8589
8690 if let Some ( config) = config {
8791 dev_runner = dev_runner. config ( config. to_string ( ) ) ;
You can’t perform that action at this time.
0 commit comments