11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
4+ use super :: { create_template, template} ;
45#[ cfg( any( target_os = "linux" , target_os = "windows" ) ) ]
56use crate :: local:: coverage;
67use crate :: local:: { common:: add_common_config, libfuzzer_fuzz, tui:: TerminalUi } ;
78use anyhow:: { Context , Result } ;
9+
810use clap:: { Arg , ArgAction , Command } ;
911use std:: time:: Duration ;
1012use std:: { path:: PathBuf , str:: FromStr } ;
1113use strum:: IntoEnumIterator ;
1214use strum_macros:: { EnumIter , EnumString , IntoStaticStr } ;
1315use tokio:: { select, time:: timeout} ;
14-
15- use super :: template;
16-
1716#[ derive( Debug , PartialEq , Eq , EnumString , IntoStaticStr , EnumIter ) ]
1817#[ strum( serialize_all = "kebab-case" ) ]
1918enum Commands {
2019 #[ cfg( any( target_os = "linux" , target_os = "windows" ) ) ]
2120 Coverage ,
2221 LibfuzzerFuzz ,
2322 Template ,
23+ CreateTemplate ,
2424}
2525
2626const TIMEOUT : & str = "timeout" ;
@@ -43,7 +43,7 @@ pub async fn run(args: clap::ArgMatches) -> Result<()> {
4343
4444 let sub_args = sub_args. clone ( ) ;
4545
46- let terminal = if start_ui {
46+ let terminal = if start_ui && command != Commands :: CreateTemplate {
4747 Some ( TerminalUi :: init ( ) ?)
4848 } else {
4949 env_logger:: Builder :: from_env ( env_logger:: Env :: default ( ) . default_filter_or ( "info" ) ) . init ( ) ;
@@ -62,6 +62,7 @@ pub async fn run(args: clap::ArgMatches) -> Result<()> {
6262
6363 template:: launch ( config, event_sender) . await
6464 }
65+ Commands :: CreateTemplate => create_template:: run ( ) ,
6566 }
6667 } ) ;
6768
@@ -116,6 +117,7 @@ pub fn args(name: &'static str) -> Command {
116117 . args ( vec ! [ Arg :: new( "config" )
117118 . value_parser( value_parser!( std:: path:: PathBuf ) )
118119 . required( true ) ] ) ,
120+ Commands :: CreateTemplate => create_template:: args ( subcommand. into ( ) ) ,
119121 } ;
120122
121123 cmd = if add_common {
0 commit comments