@@ -14,10 +14,11 @@ use tracing::info;
1414
1515use crate :: {
1616 cli:: {
17- Cli , Command , OutputFormat , OverrideCommand , SelfCommand , ShowCommand , ToolchainCommand ,
18- ToolchainListDetail ,
17+ Cli , Command , OutputColorMode , OutputFormat , OverrideCommand , SelfCommand , ShowCommand ,
18+ ToolchainCommand , ToolchainListDetail ,
1919 } ,
2020 errors:: Result ,
21+ output_style,
2122 types:: {
2223 NodeupCommand , NodeupOverrideCommand , NodeupSelfCommand , NodeupShowCommand ,
2324 NodeupToolchainCommand ,
@@ -29,21 +30,23 @@ pub fn execute(cli: Cli, app: &NodeupApp) -> Result<i32> {
2930 log_command_invocation ( & cli. command , cli. output ) ;
3031
3132 match cli. command {
32- Command :: Toolchain { command } => toolchain:: execute ( command, cli. output , app) ,
33- Command :: Default { runtime } => default_cmd:: execute ( runtime. as_deref ( ) , cli. output , app) ,
34- Command :: Show { command } => show:: execute ( command, cli. output , app) ,
35- Command :: Update { runtimes } => update_check:: update ( runtimes, cli. output , app) ,
36- Command :: Check => update_check:: check ( cli. output , app) ,
37- Command :: Override { command } => override_cmd:: execute ( command, cli. output , app) ,
33+ Command :: Toolchain { command } => toolchain:: execute ( command, cli. output , cli. color , app) ,
34+ Command :: Default { runtime } => {
35+ default_cmd:: execute ( runtime. as_deref ( ) , cli. output , cli. color , app)
36+ }
37+ Command :: Show { command } => show:: execute ( command, cli. output , cli. color , app) ,
38+ Command :: Update { runtimes } => update_check:: update ( runtimes, cli. output , cli. color , app) ,
39+ Command :: Check => update_check:: check ( cli. output , cli. color , app) ,
40+ Command :: Override { command } => override_cmd:: execute ( command, cli. output , cli. color , app) ,
3841 Command :: Which { runtime, command } => {
39- which_cmd:: execute ( runtime. as_deref ( ) , & command, cli. output , app)
42+ which_cmd:: execute ( runtime. as_deref ( ) , & command, cli. output , cli . color , app)
4043 }
4144 Command :: Run {
4245 install,
4346 runtime,
4447 command,
45- } => run_cmd:: execute ( install, & runtime, & command, cli. output , app) ,
46- Command :: SelfCmd { command } => self_cmd:: execute ( command, cli. output , app) ,
48+ } => run_cmd:: execute ( install, & runtime, & command, cli. output , cli . color , app) ,
49+ Command :: SelfCmd { command } => self_cmd:: execute ( command, cli. output , cli . color , app) ,
4750 Command :: Completions { shell, command } => {
4851 skeleton:: completions ( & shell, command. as_deref ( ) )
4952 }
@@ -52,11 +55,12 @@ pub fn execute(cli: Cli, app: &NodeupApp) -> Result<i32> {
5255
5356pub fn print_output < T : Serialize > (
5457 output : OutputFormat ,
58+ color : Option < OutputColorMode > ,
5559 human_line : & str ,
5660 json_value : & T ,
5761) -> Result < ( ) > {
5862 match output {
59- OutputFormat :: Human => println ! ( "{human_line}" ) ,
63+ OutputFormat :: Human => println ! ( "{}" , output_style :: style_human_stdout ( human_line , color ) ) ,
6064 OutputFormat :: Json => println ! ( "{}" , serde_json:: to_string_pretty( json_value) ?) ,
6165 }
6266
0 commit comments