Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
27b0be266b | |||
663d531003 | |||
56c31d79ff |
@ -109,15 +109,6 @@ A couple of variables can be edited by the user in order to configure
|
|||||||
set its value to ~("/dev" "zroot")~.
|
set its value to ~("/dev" "zroot")~.
|
||||||
|
|
||||||
Default value: ~("/dev")~
|
Default value: ~("/dev")~
|
||||||
- ~eshell-info-banner-filter-duplicate-partitions~ :: Try to filter
|
|
||||||
out duplicate partitions. Two partitions are considered duplicate if
|
|
||||||
they have the same size and amount of space used.
|
|
||||||
|
|
||||||
Default value: ~nil~
|
|
||||||
- ~eshell-info-banner-exclude-partitions~ :: List of pattens to exclude
|
|
||||||
from the partition list.
|
|
||||||
|
|
||||||
Default value: ~nil~
|
|
||||||
- ~eshell-info-banner-shorten-path-from~ :: Maximum length of the mount
|
- ~eshell-info-banner-shorten-path-from~ :: Maximum length of the mount
|
||||||
path of a partition before it gets abbreviated. Set it to ridiculous
|
path of a partition before it gets abbreviated. Set it to ridiculous
|
||||||
numbers in order to disable it (something like ~1000~ should be more
|
numbers in order to disable it (something like ~1000~ should be more
|
||||||
|
@ -139,21 +139,6 @@
|
|||||||
:group 'eshell-info-banner
|
:group 'eshell-info-banner
|
||||||
:type 'list)
|
:type 'list)
|
||||||
|
|
||||||
(defcustom eshell-info-banner-filter-duplicate-partitions nil
|
|
||||||
"Whether to filter duplicate partitions.
|
|
||||||
|
|
||||||
Two partitions are considered duplicate if they have the same
|
|
||||||
size and amount of space used."
|
|
||||||
:group 'eshell-info-banner
|
|
||||||
:type 'boolean)
|
|
||||||
|
|
||||||
(defcustom eshell-info-banner-exclude-partitions nil
|
|
||||||
"List of patterns to exclude from the partition list.
|
|
||||||
|
|
||||||
Patterns are matched against the partition name with
|
|
||||||
`string-match-p'."
|
|
||||||
:group 'eshell-info-banner
|
|
||||||
:type '(repeat string))
|
|
||||||
|
|
||||||
(defmacro eshell-info-banner--executable-find (program)
|
(defmacro eshell-info-banner--executable-find (program)
|
||||||
"Find PROGRAM executable, possibly on a remote machine.
|
"Find PROGRAM executable, possibly on a remote machine.
|
||||||
@ -432,52 +417,24 @@ Return detected partitions as a list of structs. See
|
|||||||
chosen. Relies on the `df' command."
|
chosen. Relies on the `df' command."
|
||||||
(eshell-info-banner--get-mounted-partitions-df 8))
|
(eshell-info-banner--get-mounted-partitions-df 8))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions-1 ()
|
(defun eshell-info-banner--get-mounted-partitions ()
|
||||||
"Detect mounted partitions on the system.
|
"Detect mounted partitions on the system.
|
||||||
|
|
||||||
Return detected partitions as a list of structs."
|
Return detected partitions as a list of structs."
|
||||||
(if eshell-info-banner-use-duf
|
(if eshell-info-banner-use-duf
|
||||||
(eshell-info-banner--get-mounted-partitions-duf)
|
(eshell-info-banner--get-mounted-partitions-duf)
|
||||||
(pcase system-type
|
(pcase system-type
|
||||||
((or 'gnu 'gnu/linux 'gnu/kfreebsd 'berkeley-unix)
|
((or 'gnu 'gnu/linux 'gnu/kfreebsd 'berkeley-unix)
|
||||||
(eshell-info-banner--get-mounted-partitions-gnu))
|
(eshell-info-banner--get-mounted-partitions-gnu))
|
||||||
((or 'ms-dos 'windows-nt 'cygwin)
|
((or 'ms-dos 'windows-nt 'cygwin)
|
||||||
(eshell-info-banner--get-mounted-partitions-windows))
|
(eshell-info-banner--get-mounted-partitions-windows))
|
||||||
('darwin
|
('darwin
|
||||||
(eshell-info-banner--get-mounted-partitions-darwin))
|
(eshell-info-banner--get-mounted-partitions-darwin))
|
||||||
(other
|
(other
|
||||||
(progn
|
(progn
|
||||||
(warn "Partition detection for %s not yet supported." other)
|
(warn "Partition detection for %s not yet supported." other)
|
||||||
nil)))))
|
nil)))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions ()
|
|
||||||
"Detect mounted partitions on the system.
|
|
||||||
|
|
||||||
Take `eshell-info-banner-filter-duplicate-partitions' and
|
|
||||||
`eshell-info-banner-exclude-partitions' into account."
|
|
||||||
(let ((partitions (eshell-info-banner--get-mounted-partitions-1)))
|
|
||||||
(when eshell-info-banner-filter-duplicate-partitions
|
|
||||||
(setq partitions
|
|
||||||
(cl-loop for partition in partitions
|
|
||||||
with used = nil
|
|
||||||
for signature =
|
|
||||||
(format "%d-%d"
|
|
||||||
(eshell-info-banner--mounted-partitions-size partition)
|
|
||||||
(eshell-info-banner--mounted-partitions-used partition))
|
|
||||||
unless (member signature used)
|
|
||||||
collect partition and do (push signature used))))
|
|
||||||
(when eshell-info-banner-exclude-partitions
|
|
||||||
(setq partitions
|
|
||||||
(seq-filter (lambda (partition)
|
|
||||||
(let ((path (eshell-info-banner--mounted-partitions-path
|
|
||||||
partition)))
|
|
||||||
(not (seq-some
|
|
||||||
(lambda (pattern)
|
|
||||||
(string-match-p pattern path))
|
|
||||||
eshell-info-banner-exclude-partitions))))
|
|
||||||
partitions)))
|
|
||||||
partitions))
|
|
||||||
|
|
||||||
(defun eshell-info-banner--partition-to-string (partition text-padding bar-length)
|
(defun eshell-info-banner--partition-to-string (partition text-padding bar-length)
|
||||||
"Display a progress bar showing how full a PARTITION is.
|
"Display a progress bar showing how full a PARTITION is.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user