feat: better time display and tmpdir expands homedir

This commit is contained in:
Strix 2023-10-14 22:39:48 +02:00
parent 5c15c3e075
commit fc3ae1e71a
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
3 changed files with 5 additions and 1 deletions

View file

@ -23,3 +23,5 @@ serde = { version = "1.0.171", features = ["derive"] }
libc = "0.2.80" libc = "0.2.80"
reqwest = { version = "0.11.18", features = ["blocking"] } reqwest = { version = "0.11.18", features = ["blocking"] }
tar = "0.4.39" tar = "0.4.39"
humantime = "2.1.0"
expanduser = "1.2.2"

View file

@ -94,7 +94,7 @@ impl Command {
let duration = end.duration_since(start); let duration = end.duration_since(start);
info!("Install complete."); info!("Install complete.");
info!("Install took {}ms.", duration.as_nanos() as f64 / 1000000.0); info!("Install took {}.", humantime::format_duration(duration));
} }
Command::Remove { Command::Remove {
package_identifier, package_identifier,

View file

@ -8,6 +8,8 @@ pub struct TempDir {
impl TempDir { impl TempDir {
pub fn new(path: PathBuf) -> TempDir { pub fn new(path: PathBuf) -> TempDir {
let pbs: String = path.to_str().unwrap().into();
let path = expanduser::expanduser(&pbs).unwrap();
if !path.exists() { if !path.exists() {
std::fs::create_dir_all(&path).unwrap(); std::fs::create_dir_all(&path).unwrap();
} }