@@ -86,6 +86,9 @@ pub enum Subcommand {
8686 Install {
8787 paths : Vec < PathBuf > ,
8888 } ,
89+ Run {
90+ paths : Vec < PathBuf > ,
91+ } ,
8992}
9093
9194impl Default for Subcommand {
@@ -113,6 +116,7 @@ Subcommands:
113116 clean Clean out build directories
114117 dist Build distribution artifacts
115118 install Install distribution artifacts
119+ run Run tools contained in this repository
116120
117121To learn more about a subcommand, run `./x.py <subcommand> -h`" ,
118122 ) ;
@@ -188,6 +192,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
188192 || ( s == "clean" )
189193 || ( s == "dist" )
190194 || ( s == "install" )
195+ || ( s == "run" )
191196 } ) ;
192197 let subcommand = match subcommand {
193198 Some ( s) => s,
@@ -400,6 +405,18 @@ Arguments:
400405 ./x.py doc --stage 1" ,
401406 ) ;
402407 }
408+ "run" => {
409+ subcommand_help. push_str (
410+ "\n
411+ Arguments:
412+ This subcommand accepts a number of paths to tools to build and run. For
413+ example:
414+
415+ ./x.py run src/tool/expand-yaml-anchors
416+
417+ At least a tool needs to be called." ,
418+ ) ;
419+ }
403420 _ => { }
404421 } ;
405422 // Get any optional paths which occur after the subcommand
@@ -468,6 +485,13 @@ Arguments:
468485 "fmt" => Subcommand :: Format { check : matches. opt_present ( "check" ) } ,
469486 "dist" => Subcommand :: Dist { paths } ,
470487 "install" => Subcommand :: Install { paths } ,
488+ "run" => {
489+ if paths. is_empty ( ) {
490+ println ! ( "\n run requires at least a path!\n " ) ;
491+ usage ( 1 , & opts, & subcommand_help, & extra_help) ;
492+ }
493+ Subcommand :: Run { paths }
494+ }
471495 _ => {
472496 usage ( 1 , & opts, & subcommand_help, & extra_help) ;
473497 }
0 commit comments