From 17ab47eb1d913491401d5918cda6e20ac00513e8 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 15 Sep 2022 13:34:35 +0100 Subject: jao-dirmon: fixes and little improvements to results display --- lib/eos/jao-dirmon.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/eos/jao-dirmon.el b/lib/eos/jao-dirmon.el index a2535ad..ab267fc 100644 --- a/lib/eos/jao-dirmon.el +++ b/lib/eos/jao-dirmon.el @@ -34,8 +34,8 @@ (defun jao-dirmon-sizes () (mapcar (lambda (f) - (let ((x (split-string (jao-shell-string "du -b -s" f)))) - (cons (cadr x) (/ (string-to-number (car x)) 1024 1024)))) + (let ((x (split-string (jao-shell-string "du -BM -s" f)))) + (cons (cadr x) (string-to-number (car x))))) (jao-dirmon-dirs))) (defvar jao-dirmon-threshold 100) @@ -43,9 +43,13 @@ (defun jao-dirmon--show-deltas (old current deltas) (with-temp-buffer - (insert "High deltas since " (car old) "\n------------------\n\n") + (insert "High deltas since " (car old) "\n\n") (dolist (d deltas) - (insert d "\n")) + (insert (format "- %s: %s Mb\n" (car d) (cdr d)))) + (insert "\n\nSizeable dirs\n\n") + (dolist (c (seq-sort-by #'cdr #'> current)) + (when (> (cdr c) jao-dirmon-threshold) + (insert (format "- %s: %s Mb\n" (car c) (cdr c))))) (beginning-of-buffer) (pop-to-buffer (current-buffer) nil t) (when (y-or-n-p "Save current state?") -- cgit v1.2.3