Function shellexpand::tilde
source · [−]Expand description
Performs the tilde expansion using the default system context.
This function delegates to tilde_with_context()
, using the default system source of home
directory path, namely dirs::home_dir()
function.
Examples
extern crate dirs_next as dirs;
let hds = dirs::home_dir()
.map(|p| p.display().to_string())
.unwrap_or_else(|| "~".to_owned());
assert_eq!(
shellexpand::tilde("~/some/dir"),
format!("{}/some/dir", hds)
);