-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Resolves #4483 Resolves #4484 ## Test Plan `cargo test` ```sh ❯ cargo run -- toolchain dir warning: `uv toolchain dir` is experimental and may change without warning. /Users/ahmedilyas/Library/Application Support/uv/toolchains ❯ cargo run -- tool dir warning: `uv tool dir` is experimental and may change without warning. /Users/ahmedilyas/Library/Application Support/uv/tools ```
- Loading branch information
Showing
11 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use anyhow::Context; | ||
use owo_colors::OwoColorize; | ||
use uv_configuration::PreviewMode; | ||
use uv_fs::Simplified; | ||
use uv_tool::InstalledTools; | ||
use uv_warnings::warn_user_once; | ||
|
||
/// Show the tool directory. | ||
pub(crate) fn dir(preview: PreviewMode) -> anyhow::Result<()> { | ||
if preview.is_disabled() { | ||
warn_user_once!("`uv tool dir` is experimental and may change without warning."); | ||
} | ||
let installed_tools = | ||
InstalledTools::from_settings().context("Failed to initialize tools settings")?; | ||
anstream::println!("{}", installed_tools.root().simplified_display().cyan()); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub(crate) mod dir; | ||
pub(crate) mod install; | ||
pub(crate) mod list; | ||
pub(crate) mod run; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use anyhow::Context; | ||
use owo_colors::OwoColorize; | ||
use uv_configuration::PreviewMode; | ||
use uv_fs::Simplified; | ||
use uv_toolchain::managed::InstalledToolchains; | ||
use uv_warnings::warn_user_once; | ||
|
||
/// Show the toolchain directory. | ||
pub(crate) fn dir(preview: PreviewMode) -> anyhow::Result<()> { | ||
if preview.is_disabled() { | ||
warn_user_once!("`uv toolchain dir` is experimental and may change without warning."); | ||
} | ||
let installed_toolchains = | ||
InstalledToolchains::from_settings().context("Failed to initialize toolchain settings")?; | ||
anstream::println!( | ||
"{}", | ||
installed_toolchains.root().simplified_display().cyan() | ||
); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub(crate) mod dir; | ||
pub(crate) mod find; | ||
pub(crate) mod install; | ||
pub(crate) mod list; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#![cfg(all(feature = "python", feature = "pypi"))] | ||
|
||
use assert_fs::fixture::PathChild; | ||
use common::{uv_snapshot, TestContext}; | ||
|
||
mod common; | ||
|
||
#[test] | ||
fn tool_dir() { | ||
let context = TestContext::new("3.12"); | ||
let tool_dir = context.temp_dir.child("tools"); | ||
let bin_dir = context.temp_dir.child("bin"); | ||
|
||
uv_snapshot!(context.filters(), context.tool_dir() | ||
.env("UV_TOOL_DIR", tool_dir.as_os_str()) | ||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
[TEMP_DIR]/tools | ||
----- stderr ----- | ||
warning: `uv tool dir` is experimental and may change without warning. | ||
"###); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![cfg(all(feature = "python", feature = "pypi"))] | ||
|
||
use assert_fs::fixture::PathChild; | ||
use common::{uv_snapshot, TestContext}; | ||
|
||
mod common; | ||
|
||
#[test] | ||
fn toolchain_dir() { | ||
let context = TestContext::new("3.12"); | ||
|
||
let toolchain_dir = context.temp_dir.child("toolchains"); | ||
uv_snapshot!(context.filters(), context.toolchain_dir() | ||
.env("UV_TOOLCHAIN_DIR", toolchain_dir.as_os_str()), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
[TEMP_DIR]/toolchains | ||
----- stderr ----- | ||
warning: `uv toolchain dir` is experimental and may change without warning. | ||
"###); | ||
} |