Better Windows support for partition detection with duf
This commit is contained in:
parent
1635241762
commit
d35516a354
11
README.org
11
README.org
@ -21,6 +21,7 @@ macOS. PR are welcome if you want to fix that!
|
|||||||
- [[#installation][Installation]]
|
- [[#installation][Installation]]
|
||||||
- [[#customizing][Customizing]]
|
- [[#customizing][Customizing]]
|
||||||
- [[#my-computer-doesnt-have-a-battery-will-this-still-work][My computer doesn’t have a battery, will this still work?]]
|
- [[#my-computer-doesnt-have-a-battery-will-this-still-work][My computer doesn’t have a battery, will this still work?]]
|
||||||
|
- [[#advice-for-windows-users][Advice for Windows users]]
|
||||||
- [[#contributing][Contributing]]
|
- [[#contributing][Contributing]]
|
||||||
- [[#license][License]]
|
- [[#license][License]]
|
||||||
|
|
||||||
@ -100,9 +101,7 @@ A couple of variables can be edited by the user in order to configure
|
|||||||
better replacement for ~df~ and should be more platform-agnostic than
|
better replacement for ~df~ and should be more platform-agnostic than
|
||||||
the latter. I also suspect this implementation will be faster than
|
the latter. I also suspect this implementation will be faster than
|
||||||
the one with ~df~, since there is very few string manipulation with
|
the one with ~df~, since there is very few string manipulation with
|
||||||
~duf~ compared to the implementations with ~df~. However, due to
|
~duf~ compared to the implementations with ~df~.
|
||||||
~shell-command-to-string~, Windows users might want to turn it off by
|
|
||||||
default.
|
|
||||||
|
|
||||||
Default value: ~t~ if ~duf~ is found on the system, ~nil~ otherwise
|
Default value: ~t~ if ~duf~ is found on the system, ~nil~ otherwise
|
||||||
- ~eshell-info-banner-duf-executable~ :: Path to your ~duf~ executable. If
|
- ~eshell-info-banner-duf-executable~ :: Path to your ~duf~ executable. If
|
||||||
@ -135,6 +134,12 @@ detect whether you have a battery or not/ and will only display this
|
|||||||
line if you have one. If you don’t have a battery, the only difference
|
line if you have one. If you don’t have a battery, the only difference
|
||||||
is you will have one less line than laptop users.
|
is you will have one less line than laptop users.
|
||||||
|
|
||||||
|
* Advice for Windows users
|
||||||
|
Currently, the partitions detection is done only with the ~duf~
|
||||||
|
command-line utility. If you want a list of your partitions, I
|
||||||
|
strongly encourage you to install it on your system. See
|
||||||
|
[[https://github.com/muesli/duf#windows]].
|
||||||
|
|
||||||
* Contributing
|
* Contributing
|
||||||
See [[file:CONTRIBUTING.org]].
|
See [[file:CONTRIBUTING.org]].
|
||||||
|
|
||||||
|
@ -256,11 +256,10 @@ neither of these, an error will be thrown by the function."
|
|||||||
|
|
||||||
Return detected partitions as a list of structs. See
|
Return detected partitions as a list of structs. See
|
||||||
`eshell-info-banner-partition-prefixes' to see how partitions are
|
`eshell-info-banner-partition-prefixes' to see how partitions are
|
||||||
chosen. Relies on the `duf' command.
|
chosen. Relies on the `duf' command."
|
||||||
|
(let* ((partitions (json-read-from-string (with-temp-buffer
|
||||||
FIXME: filter first partitions, then get other information."
|
(call-process "duf" nil t nil "-json")
|
||||||
(let* ((partitions (json-read-from-string (shell-command-to-string (concat eshell-info-banner-duf-executable
|
(buffer-string))))
|
||||||
" -json"))))
|
|
||||||
(partitions (cl-remove-if-not (lambda (partition)
|
(partitions (cl-remove-if-not (lambda (partition)
|
||||||
(let ((device (format "%s" (cdr (assoc 'device partition)))))
|
(let ((device (format "%s" (cdr (assoc 'device partition)))))
|
||||||
(seq-some (lambda (prefix)
|
(seq-some (lambda (prefix)
|
||||||
|
Loading…
Reference in New Issue
Block a user