From b86b9a70dee3f679ddf4e34a0f02067b3d9c475b Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 13 Dec 2023 14:34:13 +0800 Subject: eshell: a custom fs command, but not needed. * eshell-conf.el: A custom `fs` command was added and then commented as that is not really needed. --- eshell-conf.el | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/eshell-conf.el b/eshell-conf.el index 2e00cd5..c8c2605 100644 --- a/eshell-conf.el +++ b/eshell-conf.el @@ -532,6 +532,104 @@ This can preserve the original sorting method." (advice-add #'eshell-ls-sort-entries :around #'durand-eshell-ls-sort-entries) +;;; Custom command 'fs' + +;; REVIEW: Not needed? + +;; (defun eshell/fs (&rest args) +;; "Implementation of `fs'. +;; See `eshell-fs' for the actual functionality and for the format +;; of ARGS." +;; (eshell-eval-using-options +;; "fs" args +;; '((?r "reverse" 'reverse sort-mode "Sort from the smallest to the biggest. Overrides '-s'") +;; (?s "sort" nil sort-mode "Sort from the biggest to the smallest") +;; (?h "help" nil nil "Print this help message.") +;; :usage "[-hrs] [files]" +;; :parse-leading-options-only) +;; (eshell-fs sort-mode args))) + +;; (defun eshell-fs (sort-mode files) +;; "Display a summary of sizes of FILES. +;; SORT-MODE controls how to sort the display: +;; - nil: No sorting +;; - t: Sort according to sizes from the biggest down +;; - other: Sort according to sizes from the smallest up + +;; FILES is a list of files to display sizes for. If FILES is nil, +;; display the size of the current directory." +;; (message "sort-mode: %S" sort-mode) +;; (message "files: %S" files) +;; nil +;; ) + +;; Fix Lisp du + +;; (defvar block-size) +;; (defvar by-bytes) +;; (defvar dereference-links) +;; (defvar grand-total) +;; (defvar human-readable) +;; (defvar max-depth) +;; (defvar only-one-filesystem) +;; (defvar show-all) + +;; (defun durand-eshell/du (&rest args) +;; "Implementation of \"du\" in Lisp, passing ARGS. +;; Do not call external du unconditionally." +;; (setq args (if args +;; (eshell-stringify-list (flatten-tree args)) +;; '("."))) +;; (eshell-eval-using-options +;; "du" args +;; '((?a "all" nil show-all +;; "write counts for all files, not just directories") +;; (nil "block-size" t block-size +;; "use SIZE-byte blocks (i.e., --block-size SIZE)") +;; (?b "bytes" nil by-bytes +;; "print size in bytes") +;; (?c "total" nil grand-total +;; "produce a grand total") +;; (?d "max-depth" t max-depth +;; "display data only this many levels of data") +;; (?h "human-readable" 1024 human-readable +;; "print sizes in human readable format") +;; (?H "is" 1000 human-readable +;; "likewise, but use powers of 1000 not 1024") +;; (?k "kilobytes" 1024 block-size +;; "like --block-size 1024") +;; (?L "dereference" nil dereference-links +;; "dereference all symbolic links") +;; (?m "megabytes" 1048576 block-size +;; "like --block-size 1048576") +;; (?s "summarize" 0 max-depth +;; "display only a total for each argument") +;; (?x "one-file-system" nil only-one-filesystem +;; "skip directories on different filesystems") +;; (nil "help" nil nil +;; "show this usage screen") +;; :external "du" +;; :usage "[OPTION]... FILE... +;; Summarize disk usage of each FILE, recursively for directories.") +;; (unless by-bytes +;; (setq block-size (or block-size 1024))) +;; (if (and max-depth (stringp max-depth)) +;; (setq max-depth (string-to-number max-depth))) +;; ;; filesystem support means nothing under Windows +;; (if (eshell-under-windows-p) +;; (setq only-one-filesystem nil)) +;; (let ((size 0.0)) +;; (while args +;; (if only-one-filesystem +;; (setq only-one-filesystem +;; (file-attribute-device-number (eshell-file-attributes +;; (file-name-as-directory (car args)))))) +;; (setq size (+ size (eshell-du-sum-directory +;; (directory-file-name (car args)) 0))) +;; (setq args (cdr args))) +;; (if grand-total +;; (eshell-print (concat (eshell-du-size-string size) +;; "total\n")))))) ;;; Integration with Tramp -- cgit v1.2.3-18-g5258