Browse Source

Chaning print

spesk1 4 years ago
parent
commit
855fe50c97
2 changed files with 7 additions and 6 deletions
  1. 1 0
      .gitignore
  2. 6 6
      src/main.rs

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 /target
+/.sg

+ 6 - 6
src/main.rs

@@ -51,16 +51,16 @@ fn main() {
              .help("Path to find size of"))
 	.get_matches();
 
-	let total = get_fill(String::from(matches.value_of("path").unwrap()));
+    let path_string = String::from(matches.value_of("path").unwrap());
+	let total = get_fill(path_string);
     let bytes_total = total.unwrap();
     let kb_total = bytes_total as f64 / 1024.0;
     let mb_total = bytes_total as f64 / 1024.0 / 1024.0;
     let gb_total = bytes_total as f64 / 1024.0 / 1024.0 / 1024.0;
     let tb_total = bytes_total as f64 / 1024.0 / 1024.0 / 1024.0 / 1024.0;
-	println!("Total of test dir in B is: {}",bytes_total);
-	println!("Total of test dir in KB is: {}",kb_total);
-	println!("Total of test dir in MB is: {}",mb_total);
-	println!("Total of test dir in GB is: {}",gb_total);
-	println!("Total of test dir in TB is: {}",tb_total);
+    // Recreate this cause we used if for get_fill already
+    let path_string = String::from(matches.value_of("path").unwrap());
+    print!("Total of {} is: | {} B | {} KB | {} MB | {} GB | {} TB |\n",
+             path_string,bytes_total,kb_total,mb_total,gb_total,tb_total);
 
 }