@@ -43,8 +43,8 @@ const KEY_WIDTH: usize = 18;
4343
4444/// Print a section header (bold, with blank line before).
4545fn print_section ( name : & str ) {
46- println ! ( ) ;
47- println ! ( "{}" , style( & name) . bold( ) ) ;
46+ vp_shared :: output :: print_stdout_line ( format_args ! ( "" ) ) ;
47+ vp_shared :: output :: print_stdout_line ( format_args ! ( "{}" , style( & name) . bold( ) ) ) ;
4848}
4949
5050/// Print an aligned key-value line with a status indicator.
@@ -53,11 +53,11 @@ fn print_section(name: &str) {
5353/// Use `" "` for informational lines with no status.
5454fn print_check ( status : & str , key : & str , value : & str ) {
5555 if status. trim ( ) . is_empty ( ) {
56- println ! ( " {key:<KEY_WIDTH$}{value}" ) ;
56+ vp_shared :: output :: print_stdout_line ( format_args ! ( " {key:<KEY_WIDTH$}{value}" ) ) ;
5757 } else if key. trim ( ) . is_empty ( ) {
58- println ! ( " {status} {value}" ) ;
58+ vp_shared :: output :: print_stdout_line ( format_args ! ( " {status} {value}" ) ) ;
5959 } else {
60- println ! ( " {status} {key:<KEY_WIDTH$}{value}" ) ;
60+ vp_shared :: output :: print_stdout_line ( format_args ! ( " {status} {key:<KEY_WIDTH$}{value}" ) ) ;
6161 }
6262}
6363
@@ -71,7 +71,10 @@ fn print_package_manager_mode(key: &str, mode: ShimMode) {
7171
7272/// Print a continuation/hint line (dimmed).
7373fn print_hint ( text : & str ) {
74- println ! ( " {}" , style( format!( "note: {text}" ) ) . dim( ) ) ;
74+ vp_shared:: output:: print_stdout_line ( format_args ! (
75+ " {}" ,
76+ style( format!( "note: {text}" ) ) . dim( )
77+ ) ) ;
7578}
7679
7780/// Abbreviate home directory to `~` for display.
@@ -90,7 +93,7 @@ pub async fn execute(cwd: AbsolutePathBuf, scope: Option<String>) -> Result<Exit
9093 let mut has_errors = false ;
9194
9295 // Section: Installation
93- println ! ( "{}" , style( "Installation" ) . bold( ) ) ;
96+ vp_shared :: output :: print_stdout_line ( format_args ! ( "{}" , style( "Installation" ) . bold( ) ) ) ;
9497 if crate :: homebrew:: owns_current_exe ( ) {
9598 print_check ( " " , "CLI source" , "Homebrew" ) ;
9699 if let Ok ( binary) = std:: env:: current_exe ( ) . and_then ( std:: fs:: canonicalize) {
@@ -146,17 +149,20 @@ pub async fn execute(cwd: AbsolutePathBuf, scope: Option<String>) -> Result<Exit
146149 }
147150
148151 // Summary
149- println ! ( ) ;
152+ vp_shared :: output :: print_stdout_line ( format_args ! ( "" ) ) ;
150153 if has_errors {
151- println ! (
154+ vp_shared :: output :: print_stdout_line ( format_args ! (
152155 "{}" ,
153156 style( "\u{2717} Some issues found. Run the suggested commands to fix them." )
154157 . red( )
155158 . bold( )
156- ) ;
159+ ) ) ;
157160 Ok ( super :: exit_status ( 1 ) )
158161 } else {
159- println ! ( "{}" , style( "\u{2713} All checks passed" ) . green( ) . bold( ) ) ;
162+ vp_shared:: output:: print_stdout_line ( format_args ! (
163+ "{}" ,
164+ style( "\u{2713} All checks passed" ) . green( ) . bold( )
165+ ) ) ;
160166 Ok ( ExitStatus :: default ( ) )
161167 }
162168}
@@ -559,7 +565,7 @@ async fn check_path(scope: EnvScope) -> bool {
559565 & style ( "not in PATH" ) . red ( ) . to_string ( ) ,
560566 ) ;
561567 print_hint ( & format ! ( "Expected: {bin_display}" ) ) ;
562- println ! ( ) ;
568+ vp_shared :: output :: print_stdout_line ( format_args ! ( "" ) ) ;
563569 print_path_fix ( & vp_shared:: EnvConfig :: get ( ) . dirs . config ) ;
564570 return false ;
565571 }
@@ -630,28 +636,48 @@ fn print_path_fix(env_dir: &vt_path::AbsolutePath) {
630636 env_path
631637 } ;
632638
633- println ! ( " {}" , style( "Add to your shell profile (~/.zshrc, ~/.bashrc, etc.):" ) . dim( ) ) ;
634- println ! ( ) ;
635- println ! ( " . \" {env_path}/env\" " ) ;
636- println ! ( ) ;
637- println ! ( " {}" , style( "For fish shell, add to ~/.config/fish/config.fish:" ) . dim( ) ) ;
638- println ! ( ) ;
639- println ! ( " source \" {env_path}/env.fish\" " ) ;
640- println ! ( ) ;
641- println ! ( " {}" , style( "For Nushell, add to ~/.config/nushell/config.nu:" ) . dim( ) ) ;
642- println ! ( ) ;
643- println ! ( " source '{env_path}/env.nu'" ) ;
644- println ! ( ) ;
645- println ! ( " {}" , style( "Then restart your terminal." ) . dim( ) ) ;
639+ vp_shared:: output:: print_stdout_line ( format_args ! (
640+ " {}" ,
641+ style( "Add to your shell profile (~/.zshrc, ~/.bashrc, etc.):" ) . dim( )
642+ ) ) ;
643+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
644+ vp_shared:: output:: print_stdout_line ( format_args ! ( " . \" {env_path}/env\" " ) ) ;
645+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
646+ vp_shared:: output:: print_stdout_line ( format_args ! (
647+ " {}" ,
648+ style( "For fish shell, add to ~/.config/fish/config.fish:" ) . dim( )
649+ ) ) ;
650+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
651+ vp_shared:: output:: print_stdout_line ( format_args ! ( " source \" {env_path}/env.fish\" " ) ) ;
652+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
653+ vp_shared:: output:: print_stdout_line ( format_args ! (
654+ " {}" ,
655+ style( "For Nushell, add to ~/.config/nushell/config.nu:" ) . dim( )
656+ ) ) ;
657+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
658+ vp_shared:: output:: print_stdout_line ( format_args ! ( " source '{env_path}/env.nu'" ) ) ;
659+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
660+ vp_shared:: output:: print_stdout_line ( format_args ! (
661+ " {}" ,
662+ style( "Then restart your terminal." ) . dim( )
663+ ) ) ;
646664 }
647665
648666 #[ cfg( windows) ]
649667 {
650668 let _ = env_dir;
651- println ! ( " {}" , style( "Add the bin directory to your PATH via:" ) . dim( ) ) ;
652- println ! ( " System Properties -> Environment Variables -> Path" ) ;
653- println ! ( ) ;
654- println ! ( " {}" , style( "Then restart your terminal." ) . dim( ) ) ;
669+ vp_shared:: output:: print_stdout_line ( format_args ! (
670+ " {}" ,
671+ style( "Add the bin directory to your PATH via:" ) . dim( )
672+ ) ) ;
673+ vp_shared:: output:: print_stdout_line ( format_args ! (
674+ " System Properties -> Environment Variables -> Path"
675+ ) ) ;
676+ vp_shared:: output:: print_stdout_line ( format_args ! ( "" ) ) ;
677+ vp_shared:: output:: print_stdout_line ( format_args ! (
678+ " {}" ,
679+ style( "Then restart your terminal." ) . dim( )
680+ ) ) ;
655681 }
656682}
657683
@@ -705,30 +731,48 @@ fn print_ide_setup_guidance(env_dir: &vt_path::AbsolutePath) {
705731 "" ,
706732 & style ( "GUI applications may not see shell PATH changes." ) . yellow ( ) . to_string ( ) ,
707733 ) ;
708- println ! ( ) ;
734+ vp_shared :: output :: print_stdout_line ( format_args ! ( "" ) ) ;
709735
710736 #[ cfg( target_os = "macos" ) ]
711737 {
712- println ! ( " {}" , style( "macOS:" ) . dim( ) ) ;
713- println ! ( " {}" , style( "Add to ~/.zshenv or ~/.profile:" ) . dim( ) ) ;
714- println ! ( " . \" {env_path}/env\" " ) ;
715- println ! ( " {}" , style( "Then restart your IDE to apply changes." ) . dim( ) ) ;
738+ vp_shared:: output:: print_stdout_line ( format_args ! ( " {}" , style( "macOS:" ) . dim( ) ) ) ;
739+ vp_shared:: output:: print_stdout_line ( format_args ! (
740+ " {}" ,
741+ style( "Add to ~/.zshenv or ~/.profile:" ) . dim( )
742+ ) ) ;
743+ vp_shared:: output:: print_stdout_line ( format_args ! ( " . \" {env_path}/env\" " ) ) ;
744+ vp_shared:: output:: print_stdout_line ( format_args ! (
745+ " {}" ,
746+ style( "Then restart your IDE to apply changes." ) . dim( )
747+ ) ) ;
716748 }
717749
718750 #[ cfg( target_os = "linux" ) ]
719751 {
720- println ! ( " {}" , style( "Linux:" ) . dim( ) ) ;
721- println ! ( " {}" , style( "Add to ~/.profile:" ) . dim( ) ) ;
722- println ! ( " . \" {env_path}/env\" " ) ;
723- println ! ( " {}" , style( "Then log out and log back in for changes to take effect." ) . dim( ) ) ;
752+ vp_shared:: output:: print_stdout_line ( format_args ! ( " {}" , style( "Linux:" ) . dim( ) ) ) ;
753+ vp_shared:: output:: print_stdout_line ( format_args ! (
754+ " {}" ,
755+ style( "Add to ~/.profile:" ) . dim( )
756+ ) ) ;
757+ vp_shared:: output:: print_stdout_line ( format_args ! ( " . \" {env_path}/env\" " ) ) ;
758+ vp_shared:: output:: print_stdout_line ( format_args ! (
759+ " {}" ,
760+ style( "Then log out and log back in for changes to take effect." ) . dim( )
761+ ) ) ;
724762 }
725763
726764 // Fallback for other Unix platforms
727765 #[ cfg( not( any( target_os = "macos" , target_os = "linux" ) ) ) ]
728766 {
729- println ! ( " {}" , style( "Add to your shell profile:" ) . dim( ) ) ;
730- println ! ( " . \" {env_path}/env\" " ) ;
731- println ! ( " {}" , style( "Then restart your IDE to apply changes." ) . dim( ) ) ;
767+ vp_shared:: output:: print_stdout_line ( format_args ! (
768+ " {}" ,
769+ style( "Add to your shell profile:" ) . dim( )
770+ ) ) ;
771+ vp_shared:: output:: print_stdout_line ( format_args ! ( " . \" {env_path}/env\" " ) ) ;
772+ vp_shared:: output:: print_stdout_line ( format_args ! (
773+ " {}" ,
774+ style( "Then restart your IDE to apply changes." ) . dim( )
775+ ) ) ;
732776 }
733777}
734778
0 commit comments