@@ -10,6 +10,8 @@ use runner::*;
1010use std:: env;
1111pub use json;
1212
13+ pub static mut IS_QUIET : bool = false ;
14+
1315fn main ( ) -> std:: io:: Result < ( ) > {
1416 let args: Vec < String > = env:: args ( ) . collect ( ) ;
1517 let mut run_cmds = None ;
@@ -47,7 +49,7 @@ fn main()-> std::io::Result<()> {
4749 - Compiled to any language
4850 - enpp-every [filename without ext]
4951 - enpp-every [filename without ext] [language json]
50- release Zhou
52+ release Chin
5153" ) ;
5254 }
5355 else if args. len ( ) == 2 {
@@ -58,13 +60,35 @@ release Zhou
5860 let lang = json:: parse ( & std:: fs:: read_to_string ( & args[ 2 ] ) . expect ( "Cannot found the json" ) ) . expect ( "Cannot parse language json" ) ;
5961 if args[ 2 ] == "run" {
6062 path = & args[ 1 ] ;
63+ if args. len ( ) >= 4 {
64+ if args[ 3 ] == "quietly" {
65+ unsafe { IS_QUIET = true ; }
66+ }
67+ }
68+ filesys:: convert ( & args[ 1 ] , lang[ "ext" ] . as_str ( ) . unwrap_or ( "txt" ) , & lang) ?;
6169 run_cmds = Some ( lang) ;
6270 }
63- else {
71+ else if args[ 2 ] == "quietly" {
72+ unsafe { IS_QUIET = true ; }
6473 filesys:: convert ( & args[ 1 ] , lang[ "ext" ] . as_str ( ) . unwrap_or ( "txt" ) , & lang) ?;
65- if args. len ( ) == 4 {
74+ }
75+ else {
76+ if args. len ( ) >= 4 {
6677 if args[ 3 ] == "run" {
6778 path = & args[ 1 ] ;
79+ if args. len ( ) >= 5 {
80+ if args[ 4 ] == "quietly" {
81+ unsafe { IS_QUIET = true ; }
82+ }
83+ }
84+ }
85+ else if args[ 3 ] == "quietly" {
86+ unsafe { IS_QUIET = true ; }
87+ }
88+ }
89+ filesys:: convert ( & args[ 1 ] , lang[ "ext" ] . as_str ( ) . unwrap_or ( "txt" ) , & lang) ?;
90+ if args. len ( ) >= 4 {
91+ if args[ 3 ] == "run" {
6892 run_cmds = Some ( lang) ;
6993 }
7094 }
@@ -75,8 +99,10 @@ release Zhou
7599 use std:: process:: Stdio ;
76100 for c in cmds[ "run" ] . members ( ) {
77101 let cmd = transpile:: blocks:: render ( c. as_str ( ) . unwrap ( ) , & json ! ( { "file" : path} ) ) . unwrap ( ) ;
78- colour:: green!( "=>Running " ) ;
79- println ! ( "{}" , cmd) ;
102+ if !unsafe { IS_QUIET } {
103+ colour:: green!( "=>Running " ) ;
104+ println ! ( "{}" , cmd) ;
105+ }
80106 if cfg ! ( windows) {
81107 std:: process:: Command :: new ( "cmd" )
82108 . args ( & [ "/c" , & cmd] )
0 commit comments