@@ -10,7 +10,6 @@ use crate::local::{
1010} ;
1111use anyhow:: { Context , Result } ;
1212use clap:: { App , Arg , SubCommand } ;
13- use crossterm:: tty:: IsTty ;
1413use std:: str:: FromStr ;
1514use std:: time:: Duration ;
1615use strum:: IntoEnumIterator ;
@@ -36,9 +35,11 @@ enum Commands {
3635}
3736
3837const TIMEOUT : & str = "timeout" ;
38+ const TUI : & str = "tui" ;
3939
4040pub async fn run ( args : clap:: ArgMatches < ' static > ) -> Result < ( ) > {
4141 let running_duration = value_t ! ( args, TIMEOUT , u64 ) . ok ( ) ;
42+ let start_ui = args. is_present ( TUI ) ;
4243
4344 let ( cmd, sub_args) = args. subcommand ( ) ;
4445 let command =
@@ -48,7 +49,7 @@ pub async fn run(args: clap::ArgMatches<'static>) -> Result<()> {
4849 . ok_or_else ( || anyhow ! ( "missing subcommand arguments" ) ) ?
4950 . to_owned ( ) ;
5051
51- let terminal = if std :: io :: stdout ( ) . is_tty ( ) {
52+ let terminal = if start_ui {
5253 Some ( TerminalUi :: init ( ) ?)
5354 } else {
5455 env_logger:: Builder :: from_env ( env_logger:: Env :: default ( ) . default_filter_or ( "info" ) ) . init ( ) ;
@@ -111,6 +112,12 @@ pub fn args(name: &str) -> App<'static, 'static> {
111112 . long ( TIMEOUT )
112113 . help ( "The maximum running time in seconds" )
113114 . takes_value ( true ) ,
115+ )
116+ . arg (
117+ Arg :: with_name ( TUI )
118+ . long ( TUI )
119+ . help ( "Enable the terminal UI" )
120+ . takes_value ( false ) ,
114121 ) ;
115122
116123 for subcommand in Commands :: iter ( ) {
0 commit comments