dependencies: Update shellexpand to 3.0.0
This commit is contained in:
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -315,9 +315,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.7"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -472,9 +472,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.135"
|
version = "0.2.138"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
|
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
name = "libgit2-sys"
|
||||||
@@ -901,9 +901,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shellexpand"
|
name = "shellexpand"
|
||||||
version = "2.1.2"
|
version = "3.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4"
|
checksum = "dd1c7ddea665294d484c39fd0c0d2b7e35bbfe10035c5fe1854741a57f6880e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ features = ["derive"]
|
|||||||
version = "=0.15.0"
|
version = "=0.15.0"
|
||||||
|
|
||||||
[dependencies.shellexpand]
|
[dependencies.shellexpand]
|
||||||
version = "=2.1.2"
|
version = "=3.0.0"
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "=4.0.11"
|
version = "=4.0.11"
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ impl Config {
|
|||||||
|
|
||||||
pub fn normalize(&mut self) {
|
pub fn normalize(&mut self) {
|
||||||
if let Config::ConfigTrees(config) = self {
|
if let Config::ConfigTrees(config) = self {
|
||||||
let home = path::env_home().display().to_string();
|
let home = path::env_home();
|
||||||
for tree in &mut config.trees_mut().iter_mut() {
|
for tree in &mut config.trees_mut().iter_mut() {
|
||||||
if tree.root.starts_with(&home) {
|
if tree.root.starts_with(&home) {
|
||||||
// The tilde is not handled differently, it's just a normal path component for `Path`.
|
// The tilde is not handled differently, it's just a normal path component for `Path`.
|
||||||
|
|||||||
12
src/path.rs
12
src/path.rs
@@ -47,9 +47,9 @@ pub fn path_as_string(path: &Path) -> String {
|
|||||||
path.to_path_buf().into_os_string().into_string().unwrap()
|
path.to_path_buf().into_os_string().into_string().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn env_home() -> PathBuf {
|
pub fn env_home() -> String {
|
||||||
match std::env::var("HOME") {
|
match std::env::var("HOME") {
|
||||||
Ok(path) => Path::new(&path).to_path_buf(),
|
Ok(path) => path,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_error(&format!("Unable to read HOME: {}", e));
|
print_error(&format!("Unable to read HOME: {}", e));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
@@ -58,16 +58,12 @@ pub fn env_home() -> PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn expand_path(path: &Path) -> PathBuf {
|
pub fn expand_path(path: &Path) -> PathBuf {
|
||||||
fn home_dir() -> Option<PathBuf> {
|
|
||||||
Some(env_home())
|
|
||||||
}
|
|
||||||
|
|
||||||
let expanded_path = match shellexpand::full_with_context(
|
let expanded_path = match shellexpand::full_with_context(
|
||||||
&path_as_string(path),
|
&path_as_string(path),
|
||||||
home_dir,
|
|| Some(env_home()),
|
||||||
|name| -> Result<Option<String>, &'static str> {
|
|name| -> Result<Option<String>, &'static str> {
|
||||||
match name {
|
match name {
|
||||||
"HOME" => Ok(Some(path_as_string(home_dir().unwrap().as_path()))),
|
"HOME" => Ok(Some(env_home())),
|
||||||
_ => Ok(None),
|
_ => Ok(None),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user