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]]
 | 
			
		||||
- [[#customizing][Customizing]]
 | 
			
		||||
- [[#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]]
 | 
			
		||||
- [[#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
 | 
			
		||||
  the latter. I also suspect this implementation will be faster than
 | 
			
		||||
  the one with ~df~, since there is very few string manipulation with
 | 
			
		||||
  ~duf~ compared to the implementations with ~df~. However, due to
 | 
			
		||||
  ~shell-command-to-string~, Windows users might want to turn it off by
 | 
			
		||||
  default.
 | 
			
		||||
  ~duf~ compared to the implementations with ~df~.
 | 
			
		||||
 | 
			
		||||
  Default value: ~t~ if ~duf~ is found on the system, ~nil~ otherwise
 | 
			
		||||
- ~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
 | 
			
		||||
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
 | 
			
		||||
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
 | 
			
		||||
`eshell-info-banner-partition-prefixes' to see how partitions are
 | 
			
		||||
chosen. Relies on the `duf' command.
 | 
			
		||||
 | 
			
		||||
FIXME: filter first partitions, then get other information."
 | 
			
		||||
    (let* ((partitions (json-read-from-string (shell-command-to-string (concat eshell-info-banner-duf-executable
 | 
			
		||||
                                                                               " -json"))))
 | 
			
		||||
chosen. Relies on the `duf' command."
 | 
			
		||||
    (let* ((partitions (json-read-from-string (with-temp-buffer
 | 
			
		||||
                                                (call-process "duf" nil t nil "-json")
 | 
			
		||||
                                                (buffer-string))))
 | 
			
		||||
           (partitions (cl-remove-if-not (lambda (partition)
 | 
			
		||||
                                           (let ((device (format "%s" (cdr (assoc 'device partition)))))
 | 
			
		||||
                                             (seq-some (lambda (prefix)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user