11use crate :: dfxvm_init:: plan:: { DfxVersion , Plan } ;
22use console:: style;
33
4+ // Most of the text in this file is derived/copied/modified from:
5+ // https://github.com/rust-lang/rustup/blob/master/src/cli/self_update.rs
6+
47pub fn introduction ( plan : & Plan ) {
58 println ! ( ) ;
69 println ! ( "{}" , style( "Welcome to dfxvm!" ) . bold( ) ) ;
@@ -14,6 +17,16 @@ pub fn introduction(plan: &Plan) {
1417 ) ;
1518 println ! ( ) ;
1619 println ! ( " {}" , plan. bin_dir. display( ) ) ;
20+ if !plan. profile_scripts . is_empty ( ) {
21+ println ! ( ) ;
22+ println ! ( "This path will then be added to your PATH environment variable by" ) ;
23+ println ! ( "modifying the profile files located at:" ) ;
24+ println ! ( ) ;
25+
26+ for script in & plan. profile_scripts {
27+ println ! ( " {}" , script. path. display( ) ) ;
28+ }
29+ }
1730 println ! ( ) ;
1831}
1932
@@ -23,20 +36,43 @@ pub fn options(plan: &Plan) {
2336 DfxVersion :: Latest => "latest" . to_string ( ) ,
2437 DfxVersion :: Specific ( version) => version. to_string ( ) ,
2538 } ;
39+ let modify_path = if options. modify_path { "yes" } else { "no" } ;
2640
2741 println ! ( "Current installation options:" ) ;
2842 println ! ( ) ;
29- println ! ( " dfx version: {}" , style( dfx_version) . bold( ) ) ;
43+ println ! ( " dfx version: {}" , style( dfx_version) . bold( ) ) ;
44+ println ! ( " modify PATH variable: {}" , style( modify_path) . bold( ) ) ;
3045 println ! ( ) ;
3146}
3247
3348pub fn success ( plan : & Plan ) {
3449 println ! ( ) ;
3550 println ! ( "{}" , style( "dfxvm is installed now." ) . bold( ) ) ;
3651 println ! ( ) ;
37- println ! ( "The installation process doesn't yet update profile scripts" ) ;
38- println ! ( "to add the dfxvm bin directory to your $PATH." ) ;
52+ if plan. options . modify_path {
53+ post_install_msg_unix_modify_path ( plan) ;
54+ } else {
55+ post_install_msg_unix_no_modify_path ( plan) ;
56+ }
57+ }
58+
59+ pub fn post_install_msg_unix_modify_path ( plan : & Plan ) {
60+ println ! ( "To get started you may need to restart your current shell." ) ;
61+ println ! ( "This would reload your PATH environment variable to include" ) ;
62+ println ! ( "the dfxvm bin directory." ) ;
3963 println ! ( ) ;
64+ post_install_msg_unix_configure_shell ( plan) ;
65+ }
66+
67+ pub fn post_install_msg_unix_no_modify_path ( plan : & Plan ) {
68+ println ! ( "To get started you need the dfxvm bin directory in your PATH:" ) ;
69+ println ! ( " {}" , style( & plan. bin_dir. display( ) ) . bold( ) ) ;
70+ println ! ( "This has not been done automatically." ) ;
71+ println ! ( ) ;
72+ post_install_msg_unix_configure_shell ( plan) ;
73+ }
74+
75+ pub fn post_install_msg_unix_configure_shell ( plan : & Plan ) {
4076 println ! ( "To configure your shell, run:" ) ;
4177 println ! ( r#" source "{}""# , plan. env_path_user_facing) ;
4278 println ! ( ) ;
0 commit comments