[−][src]Function shellexpand::tilde
pub fn tilde<SI: ?Sized>(input: &SI) -> Cow<str> where
SI: AsRef<str>,
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; 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) );