Skip to content

Commit

Permalink
shellexpand: upgrade to shellexpand v3
Browse files Browse the repository at this point in the history
shellexpand now requires that the home_dir context function returns
an Option<String> rather than an Option<std::path::Path>.

Upgrade the shellexpand crate and garden API usage accordingly.
  • Loading branch information
davvid committed Dec 29, 2023
1 parent 7cabb17 commit 89e93b9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 37 deletions.
57 changes: 24 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ is-terminal = "0.4.10"
pathdiff = "0.2.1"
rayon = "1.8.0"
rm_rf = "0.6.2"
shellexpand = "2.1.2"
shellexpand = { version = "3.1.0", features = ["full"] }
shell-words = "1.1.0"
shlex = "1.2.0"
strum = "0.25.0"
Expand Down
6 changes: 3 additions & 3 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ fn expand_graft_vars(
}

/// Resolve ~ to the current user's home directory
fn home_dir() -> Option<std::path::PathBuf> {
fn home_dir() -> Option<String> {
// Honor $HOME when set in the environment.
if let Ok(home) = std::env::var("HOME") {
return Some(std::path::PathBuf::from(home));
return Some(home);
}
dirs::home_dir()
dirs::home_dir().map(|x| x.to_string_lossy().to_string())
}

/// Resolve an expression in a garden/tree/global scope
Expand Down

0 comments on commit 89e93b9

Please sign in to comment.