@@ -62,6 +62,18 @@ struct V2CliOptions {
6262 ) ]
6363 cli_color : String ,
6464
65+ /// Use this URL to find resource files instead of the default
66+ #[ structopt(
67+ takes_value( true ) ,
68+ long,
69+ short,
70+ name = "url" ,
71+ overrides_with = "url" ,
72+ global( true )
73+ ) ]
74+ // TODO add URL validation
75+ web_bundle : Option < String > ,
76+
6577 #[ structopt( subcommand) ]
6678 command : Commands ,
6779}
@@ -138,7 +150,7 @@ pub fn v2_main(effective_args: &[OsString]) {
138150
139151 // Now that we've got colorized output, pass off to the inner function.
140152
141- let code = match args. command . execute ( config, & mut * status) {
153+ let code = match args. command . execute ( config, & mut * status, args . web_bundle ) {
142154 Ok ( c) => c,
143155 Err ( e) => {
144156 status. report_error ( & SyncError :: new ( e) . into ( ) ) ;
@@ -204,14 +216,19 @@ impl Commands {
204216 }
205217 }
206218
207- fn execute ( self , config : PersistentConfig , status : & mut dyn StatusBackend ) -> Result < i32 > {
219+ fn execute (
220+ self ,
221+ config : PersistentConfig ,
222+ status : & mut dyn StatusBackend ,
223+ web_bundle : Option < String > ,
224+ ) -> Result < i32 > {
208225 match self {
209- Commands :: Build ( o) => o. execute ( config, status) ,
226+ Commands :: Build ( o) => o. execute ( config, status, web_bundle ) ,
210227 Commands :: Bundle ( o) => o. execute ( config, status) ,
211- Commands :: Compile ( o) => o. execute ( config, status) ,
228+ Commands :: Compile ( o) => o. execute ( config, status, web_bundle ) ,
212229 Commands :: Dump ( o) => o. execute ( config, status) ,
213- Commands :: New ( o) => o. execute ( config, status) ,
214- Commands :: Init ( o) => o. execute ( config, status) ,
230+ Commands :: New ( o) => o. execute ( config, status, web_bundle ) ,
231+ Commands :: Init ( o) => o. execute ( config, status, web_bundle ) ,
215232 Commands :: Show ( o) => o. execute ( config, status) ,
216233 Commands :: Watch ( o) => o. execute ( config, status) ,
217234 Commands :: External ( args) => do_external ( args) ,
@@ -254,7 +271,18 @@ pub struct BuildCommand {
254271impl BuildCommand {
255272 fn customize ( & self , _cc : & mut CommandCustomizations ) { }
256273
257- fn execute ( self , config : PersistentConfig , status : & mut dyn StatusBackend ) -> Result < i32 > {
274+ fn execute (
275+ self ,
276+ config : PersistentConfig ,
277+ status : & mut dyn StatusBackend ,
278+ web_bundle : Option < String > ,
279+ ) -> Result < i32 > {
280+ // `--web-bundle` is not actually used for `-X build`,
281+ // so inform the user instead of ignoring silently.
282+ if let Some ( url) = web_bundle {
283+ tt_note ! ( status, "--web-bundle {} ignored" , & url) ;
284+ tt_note ! ( status, "using workspace bundle configuration" ) ;
285+ }
258286 let ws = Workspace :: open_from_environment ( ) ?;
259287 let doc = ws. first_document ( ) ;
260288
@@ -681,7 +709,12 @@ pub struct NewCommand {
681709impl NewCommand {
682710 fn customize ( & self , _cc : & mut CommandCustomizations ) { }
683711
684- fn execute ( self , config : PersistentConfig , status : & mut dyn StatusBackend ) -> Result < i32 > {
712+ fn execute (
713+ self ,
714+ config : PersistentConfig ,
715+ status : & mut dyn StatusBackend ,
716+ web_bundle : Option < String > ,
717+ ) -> Result < i32 > {
685718 tt_note ! (
686719 status,
687720 "creating new document in directory `{}`" ,
@@ -690,7 +723,7 @@ impl NewCommand {
690723
691724 let wc = WorkspaceCreator :: new ( self . path ) ;
692725 ctry ! (
693- wc. create_defaulted( & config, status) ;
726+ wc. create_defaulted( config, status, web_bundle ) ;
694727 "failed to create the new Tectonic workspace"
695728 ) ;
696729 Ok ( 0 )
@@ -704,7 +737,12 @@ pub struct InitCommand {}
704737impl InitCommand {
705738 fn customize ( & self , _cc : & mut CommandCustomizations ) { }
706739
707- fn execute ( self , config : PersistentConfig , status : & mut dyn StatusBackend ) -> Result < i32 > {
740+ fn execute (
741+ self ,
742+ config : PersistentConfig ,
743+ status : & mut dyn StatusBackend ,
744+ web_bundle : Option < String > ,
745+ ) -> Result < i32 > {
708746 let path = env:: current_dir ( ) ?;
709747 tt_note ! (
710748 status,
@@ -714,7 +752,7 @@ impl InitCommand {
714752
715753 let wc = WorkspaceCreator :: new ( path) ;
716754 ctry ! (
717- wc. create_defaulted( & config, status) ;
755+ wc. create_defaulted( config, status, web_bundle ) ;
718756 "failed to create the new Tectonic workspace"
719757 ) ;
720758 Ok ( 0 )
0 commit comments