Fix df-related code
This commit is contained in:
		
							parent
							
								
									312f1e3da3
								
							
						
					
					
						commit
						0bd70d0d0f
					
				| @ -301,28 +301,29 @@ Common function between | |||||||
| otherwise differ solely on the position of the mount point in the | otherwise differ solely on the position of the mount point in the | ||||||
| partition list. Its position is given by the argument | partition list. Its position is given by the argument | ||||||
| MOUNT-POSITION." | MOUNT-POSITION." | ||||||
|   (let ((partitions (split-string (eshell-info-banner--shell-command-to-string "df -lH") |   (let ((partitions (cdr (split-string (eshell-info-banner--shell-command-to-string "df -lH") | ||||||
|                                   (regexp-quote "\n") |                                        (regexp-quote "\n") | ||||||
|                                   t))) |                                        t)))) | ||||||
|     (seq-filter (lambda (partition) |     (cl-remove-if #'null | ||||||
|                   (let* ((partition  (split-string partition " " t)) |                   (mapcar (lambda (partition) | ||||||
|                          (filesystem (nth 0 partition)) |                             (let* ((partition  (split-string partition " " t)) | ||||||
|                          (size       (nth 1 partition)) |                                    (filesystem (nth 0 partition)) | ||||||
|                          (used       (nth 2 partition)) |                                    (size       (nth 1 partition)) | ||||||
|                          (percent    (nth 4 partition)) |                                    (used       (nth 2 partition)) | ||||||
|                          (mount      (nth mount-position partition))) |                                    (percent    (nth 4 partition)) | ||||||
|                     (unless (seq-some (lambda (prefix) |                                    (mount      (nth mount-position partition))) | ||||||
|                                         (string-prefix-p prefix filesystem t)) |                               (when (seq-some (lambda (prefix) | ||||||
|                                       eshell-info-banner-partition-prefixes) |                                                 (string-prefix-p prefix filesystem t)) | ||||||
|                       (make-eshell-info-banner--mounted-partitions |                                               eshell-info-banner-partition-prefixes) | ||||||
|                        :path (if (> (length mount) eshell-info-banner-shorten-path-from) |                                 (make-eshell-info-banner--mounted-partitions | ||||||
|                                  (eshell-info-banner--abbr-path mount t) |                                  :path (if (> (length mount) eshell-info-banner-shorten-path-from) | ||||||
|                                mount) |                                            (eshell-info-banner--abbr-path mount t) | ||||||
|                        :size size |                                          mount) | ||||||
|                        :used used |                                  :size size | ||||||
|                        :percent (string-to-number |                                  :used used | ||||||
|                                  (string-trim-left percent (regexp-quote "%"))))))) |                                  :percent (string-to-number | ||||||
|            partitions))) |                                            (string-trim-left percent (regexp-quote "%"))))))) | ||||||
|  |                           partitions)))) | ||||||
| 
 | 
 | ||||||
| (defun eshell-info-banner--get-mounted-partitions-gnu () | (defun eshell-info-banner--get-mounted-partitions-gnu () | ||||||
|   "Detect mounted partitions on a Linux system. |   "Detect mounted partitions on a Linux system. | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user