feat: better time display and tmpdir expands homedir
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Didier Slof 2023-08-07 16:19:10 +02:00
parent 9d8c9154b0
commit f8f95546fd
Signed by: didier
GPG key ID: 01E71F18AA4398E5
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();
} }