File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " cli.rs " : patch
3+ ---
4+
5+ Allow ` config ` arg to be a path to a JSON file on the ` dev ` and ` build ` commands.
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ subcommands:
1515 - config :
1616 short : c
1717 long : config
18- about : config JSON to merge with tauri.conf.json
18+ about : JSON string or path to JSON file to merge with tauri.conf.json
1919 takes_value : true
2020 - exit-on-panic :
2121 short : e
@@ -66,7 +66,7 @@ subcommands:
6666 - config :
6767 short : c
6868 long : config
69- about : config JSON to merge with tauri.conf.json
69+ about : JSON string or path to JSON file to merge with tauri.conf.json
7070 takes_value : true
7171 - target :
7272 short : t
Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ macro_rules! value_or_prompt {
5757 } } ;
5858}
5959
60+ fn get_config ( config : & str ) -> Result < String > {
61+ if config. starts_with ( '{' ) {
62+ Ok ( config. into ( ) )
63+ } else {
64+ std:: fs:: read_to_string ( & config) . map_err ( Into :: into)
65+ }
66+ }
67+
6068fn plugin_command ( matches : & ArgMatches ) -> Result < ( ) > {
6169 if let Some ( matches) = matches. subcommand_matches ( "init" ) {
6270 let api = matches. is_present ( "api" ) ;
@@ -199,7 +207,7 @@ fn dev_command(matches: &ArgMatches) -> Result<()> {
199207 dev_runner = dev_runner. target ( target. to_string ( ) ) ;
200208 }
201209 if let Some ( config) = config {
202- dev_runner = dev_runner. config ( config . to_string ( ) ) ;
210+ dev_runner = dev_runner. config ( get_config ( config ) ? ) ;
203211 }
204212
205213 dev_runner. run ( )
@@ -234,7 +242,7 @@ fn build_command(matches: &ArgMatches) -> Result<()> {
234242 build_runner = build_runner. bundles ( bundles) ;
235243 }
236244 if let Some ( config) = config {
237- build_runner = build_runner. config ( config . to_string ( ) ) ;
245+ build_runner = build_runner. config ( get_config ( config ) ? ) ;
238246 }
239247
240248 build_runner. run ( )
You can’t perform that action at this time.
0 commit comments