diff --git a/README.md b/README.md index ac341c1f..fdd7ab84 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,18 @@ To launch the default Julia version simply run `julia` in your terminal. To launch a specific Julia version, say in channel `release`, run `julia +release`. +On Unix-like platforms, `juliaup config channelsymlinks true` creates a +separate executable name for each installed channel. These entries are named +`julia-`, for example `julia-release`, and point to the Julia version +for that channel. + +Juliaup creates these channel symlinks in the directory returned by +`JULIAUP_BIN_DIR` when that environment variable is set. If `JULIAUP_BIN_DIR` +contains multiple entries separated like `PATH`, Juliaup uses the first entry. +When `JULIAUP_BIN_DIR` is not set, Juliaup uses the directory containing the +running `juliaup` executable if that directory is inside the user's home +directory; otherwise it uses `~/.local/bin`. + ## Overrides The Julia launcher `julia` automatically determines which specific version of Julia to launch. There are several ways to control and override which Juliaup channel should be used: diff --git a/src/operations.rs b/src/operations.rs index b7aa9e61..be1bcf3f 100644 --- a/src/operations.rs +++ b/src/operations.rs @@ -1724,8 +1724,9 @@ fn create_system_channel_symlink( print_juliaup_style( "Updating", &format!( - "symlink {} ( {} -> {} )", + "symlink {} at {} ( {} -> {} )", symlink_name, + symlink_path.display(), prev_target.to_string_lossy(), version ), @@ -1734,7 +1735,12 @@ fn create_system_channel_symlink( } else { print_juliaup_style( "Creating", - &format!("symlink {} for Julia {}", symlink_name, version), + &format!( + "symlink {} at {} for Julia {}", + symlink_name, + symlink_path.display(), + version + ), JuliaupMessageType::Progress, ); } @@ -1763,8 +1769,9 @@ fn create_direct_download_symlink( print_juliaup_style( "Updating", &format!( - "symlink {} ( {} -> {} )", + "symlink {} at {} ( {} -> {} )", symlink_name, + symlink_path.display(), prev_target.to_string_lossy(), version ), @@ -1773,7 +1780,12 @@ fn create_direct_download_symlink( } else { print_juliaup_style( "Creating", - &format!("symlink {} for Julia {}", symlink_name, version), + &format!( + "symlink {} at {} for Julia {}", + symlink_name, + symlink_path.display(), + version + ), JuliaupMessageType::Progress, ); } @@ -1804,8 +1816,9 @@ fn create_linked_channel_shim( print_juliaup_style( "Updating", &format!( - "shim {} ( {} -> {} )", + "shim {} at {} ( {} -> {} )", symlink_name, + symlink_path.display(), prev_target.to_string_lossy(), formatted_command ), @@ -1814,7 +1827,12 @@ fn create_linked_channel_shim( } else { print_juliaup_style( "Creating", - &format!("shim {} for {}", symlink_name, formatted_command), + &format!( + "shim {} at {} for {}", + symlink_name, + symlink_path.display(), + formatted_command + ), JuliaupMessageType::Progress, ); } diff --git a/tests/command_config_symlinks.rs b/tests/command_config_symlinks.rs new file mode 100644 index 00000000..8fd8a246 --- /dev/null +++ b/tests/command_config_symlinks.rs @@ -0,0 +1,42 @@ +#[cfg(not(windows))] +use predicates::prelude::*; + +#[cfg(not(windows))] +mod utils; + +#[cfg(not(windows))] +use utils::TestEnv; + +#[cfg(not(windows))] +#[test] +fn channelsymlinks_reports_destination_path() { + let env = TestEnv::new(); + let bin_dir = assert_fs::TempDir::new().unwrap(); + let expected_symlink = bin_dir.path().join("julia-release"); + + env.juliaup() + .arg("add") + .arg("release") + .assert() + .success() + .stdout(""); + + env.juliaup() + .env("JULIAUP_BIN_DIR", bin_dir.path()) + .arg("config") + .arg("channelsymlinks") + .arg("true") + .assert() + .success() + .stderr( + predicate::str::contains(format!( + "Creating symlink julia-release at {}", + expected_symlink.display() + )) + .and(predicate::str::contains( + "Configure Property 'channelsymlinks' set to 'true'", + )), + ); + + assert!(expected_symlink.exists()); +}