Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
60daf22d32
|
|||
|
|
32a65e4a6a | ||
|
36d1b981be
|
|||
| 6dc46a1ab9 | |||
|
|
446967b768 |
26
README.org
26
README.org
@@ -18,6 +18,8 @@ macOS. PR are welcome if you want to fix that!
|
|||||||
|
|
||||||
* Table of Contents :TOC_2_gh:
|
* Table of Contents :TOC_2_gh:
|
||||||
- [[#introduction][Introduction]]
|
- [[#introduction][Introduction]]
|
||||||
|
- [[#recent-breaking-changes][Recent Breaking Changes]]
|
||||||
|
- [[#070][~0.7.0~]]
|
||||||
- [[#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?]]
|
||||||
@@ -25,6 +27,30 @@ macOS. PR are welcome if you want to fix that!
|
|||||||
- [[#contributing][Contributing]]
|
- [[#contributing][Contributing]]
|
||||||
- [[#license][License]]
|
- [[#license][License]]
|
||||||
|
|
||||||
|
* Recent Breaking Changes
|
||||||
|
** ~0.7.0~
|
||||||
|
Version ~0.7.0~ renames several functions to conform with the Elisp
|
||||||
|
Coding Conventions.
|
||||||
|
| Old Name | New Name |
|
||||||
|
|----------------------------------------------------+----------------------------------------------------|
|
||||||
|
| ~eshell-info-banner--ge-mounted-partitions/duf~ | ~eshell-info-banner--ge-mounted-partitions-duf~ |
|
||||||
|
| ~eshell-info-banner--get-mounted-partitions/df~ | ~eshell-info-banner--get-mounted-partitions-df~ |
|
||||||
|
| ~eshell-info-banner--get-mounted-partitions/windows~ | ~eshell-info-banner--get-mounted-partitions-windows~ |
|
||||||
|
| ~eshell-info-banner--get-mounted-partitions/darwin~ | ~eshell-info-banner--get-mounted-partitions-darwin~ |
|
||||||
|
| ~eshell-info-banner--get-mounted-partitions/gnu~ | ~eshell-info-banner--get-mounted-partitions-gnu~ |
|
||||||
|
| ~eshell-info-banner--get-memory/gnu~ | ~eshell-info-banner--get-memory-gnu~ |
|
||||||
|
| ~eshell-info-banner--get-memory/unix~ | ~eshell-info-banner--get-memory-unix~ |
|
||||||
|
| ~eshell-info-banner--get-memory/windows~ | ~eshell-info-banner--get-memory-windows~ |
|
||||||
|
| ~eshell-info-banner--get-os-information/windows~ | ~eshell-info-banner--get-os-information-windows~ |
|
||||||
|
| ~eshell-info-banner--get-os-information/gnu~ | ~eshell-info-banner--get-os-information-gnu~ |
|
||||||
|
| ~eshell-info-banner--get-os-information/darwin~ | ~eshell-info-banner--get-os-information-darwin~ |
|
||||||
|
|
||||||
|
The following function was removed:
|
||||||
|
- ~eshell-info-banner--get-memory/darwin~
|
||||||
|
|
||||||
|
The following alias (replacing an old function) was removed:
|
||||||
|
- ~eshell-info-banner--get-memory/bsd~
|
||||||
|
|
||||||
* Installation
|
* Installation
|
||||||
A couple of options are available for installing
|
A couple of options are available for installing
|
||||||
~eshell-info-banner.el~. The first one is to clone the repository in
|
~eshell-info-banner.el~. The first one is to clone the repository in
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
;; Author: Lucien Cartier-Tilet <lucien@phundrak.com>
|
;; Author: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
|
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
;; Version: 0.6.1
|
;; Version: 0.7.1
|
||||||
;; Package-Requires: ((emacs "25") (dash "2") (f "0.20") (s "1"))
|
;; Package-Requires: ((emacs "25.1") (f "0.20") (s "1"))
|
||||||
;; Homepage: https://labs.phundrak.com/phundrak/eshell-info-banner.el
|
;; Homepage: https://labs.phundrak.com/phundrak/eshell-info-banner.el
|
||||||
|
|
||||||
;; This file is not part of GNU Emacs
|
;; This file is not part of GNU Emacs
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
;; `eshell-info-banner' is a utility for cerating an informative
|
;; `eshell-info-banner' is a utility for creating an informative
|
||||||
;; banner akin to fish_greeting if fish shell but for Eshell. It can
|
;; banner akin to fish_greeting if fish shell but for Eshell. It can
|
||||||
;; provide information on:
|
;; provide information on:
|
||||||
;; - the OS’ name
|
;; - the OS’ name
|
||||||
@@ -38,9 +38,10 @@
|
|||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'dash)
|
|
||||||
(require 'f)
|
(require 'f)
|
||||||
(require 'em-banner)
|
(require 'em-banner)
|
||||||
|
(require 'json)
|
||||||
|
(require 'seq)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -49,6 +50,7 @@
|
|||||||
|
|
||||||
(defgroup eshell-info-banner ()
|
(defgroup eshell-info-banner ()
|
||||||
"System information as your Eshell banner."
|
"System information as your Eshell banner."
|
||||||
|
:group 'eshell
|
||||||
:prefix "eshell-info-banner-"
|
:prefix "eshell-info-banner-"
|
||||||
:link '(url-link :tag "Gitea" "https://labs.phundrak.com/phundrak/eshell-info-banner.el")
|
:link '(url-link :tag "Gitea" "https://labs.phundrak.com/phundrak/eshell-info-banner.el")
|
||||||
:link '(url-link :tag "Github" "https://github.com/Phundrak/eshell-info-banner.el"))
|
:link '(url-link :tag "Github" "https://github.com/Phundrak/eshell-info-banner.el"))
|
||||||
@@ -60,7 +62,9 @@
|
|||||||
|
|
||||||
(defconst eshell-info-banner--min-length-left 8
|
(defconst eshell-info-banner--min-length-left 8
|
||||||
"Minimum length of text on the left hand side of the banner.")
|
"Minimum length of text on the left hand side of the banner.")
|
||||||
(defconst eshell-info-banner--macos-versions
|
|
||||||
|
(eval-when-compile
|
||||||
|
(defconst eshell-info-banner--macos-versions
|
||||||
'(("10.4" . "Mac OS X Tiger")
|
'(("10.4" . "Mac OS X Tiger")
|
||||||
("10.5" . "Mac OS X Leopard")
|
("10.5" . "Mac OS X Leopard")
|
||||||
("10.6" . "Mac OS X Snow Leopard")
|
("10.6" . "Mac OS X Snow Leopard")
|
||||||
@@ -79,7 +83,7 @@
|
|||||||
("11.2" . "macOS Big Sur")
|
("11.2" . "macOS Big Sur")
|
||||||
("11.3" . "macOS Big Sur")
|
("11.3" . "macOS Big Sur")
|
||||||
("11.4" . "macOS Big Sur"))
|
("11.4" . "macOS Big Sur"))
|
||||||
"Versions of OSX and macOS and their name.")
|
"Versions of OSX and macOS and their name."))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -162,17 +166,17 @@
|
|||||||
|
|
||||||
(defface eshell-info-banner-normal-face
|
(defface eshell-info-banner-normal-face
|
||||||
'((t :inherit font-lock-string-face))
|
'((t :inherit font-lock-string-face))
|
||||||
"Face for eshell-info-banner progress bars displaying acceptable levels."
|
"Face for `eshell-info-banner' progress bars displaying acceptable levels."
|
||||||
:group 'eshell-info-banner)
|
:group 'eshell-info-banner)
|
||||||
|
|
||||||
(defface eshell-info-banner-warning-face
|
(defface eshell-info-banner-warning-face
|
||||||
'((t :inherit warning))
|
'((t :inherit warning))
|
||||||
"Face for eshell-info-banner progress bars displaying high levels."
|
"Face for `eshell-info-banner' progress bars displaying high levels."
|
||||||
:group 'eshell-info-banner)
|
:group 'eshell-info-banner)
|
||||||
|
|
||||||
(defface eshell-info-banner-critical-face
|
(defface eshell-info-banner-critical-face
|
||||||
'((t :inherit error))
|
'((t :inherit error))
|
||||||
"Face for eshell-info-banner progress bars displaying critical levels."
|
"Face for `eshell-info-banner' progress bars displaying critical levels."
|
||||||
:group 'eshell-info-banner)
|
:group 'eshell-info-banner)
|
||||||
|
|
||||||
|
|
||||||
@@ -222,12 +226,12 @@ If the executable `uptime' is not found, return nil."
|
|||||||
(defun eshell-info-banner--get-longest-path (partitions)
|
(defun eshell-info-banner--get-longest-path (partitions)
|
||||||
"Return the length of the longest partition path in `PARTITIONS'.
|
"Return the length of the longest partition path in `PARTITIONS'.
|
||||||
|
|
||||||
The returned value is in any case greater than `eshell-info-banner--min-length-left'."
|
The returned value is in any case greater than
|
||||||
(-reduce-from (lambda (len partition)
|
`eshell-info-banner--min-length-left'."
|
||||||
(max len
|
(let ((length eshell-info-banner--min-length-left))
|
||||||
(length (eshell-info-banner--mounted-partitions-path partition))))
|
(dolist (partition partitions length)
|
||||||
eshell-info-banner--min-length-left
|
(setf length (max length
|
||||||
partitions))
|
(length (eshell-info-banner--mounted-partitions-path partition)))))))
|
||||||
|
|
||||||
(defun eshell-info-banner--abbr-path (path &optional abbr)
|
(defun eshell-info-banner--abbr-path (path &optional abbr)
|
||||||
"Remove `$HOME' from `PATH', abbreviate parent dirs if `ABBR' non nil.
|
"Remove `$HOME' from `PATH', abbreviate parent dirs if `ABBR' non nil.
|
||||||
@@ -260,7 +264,7 @@ neither of these, an error will be thrown by the function."
|
|||||||
(eshell-info-banner--abbr-path (cdr path))))
|
(eshell-info-banner--abbr-path (cdr path))))
|
||||||
(t (error "Invalid argument %s, neither stringp or listp" path))))
|
(t (error "Invalid argument %s, neither stringp or listp" path))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions/duf ()
|
(defun eshell-info-banner--get-mounted-partitions-duf ()
|
||||||
"Detect mounted partitions on systems supporting `duf'.
|
"Detect mounted partitions on systems supporting `duf'.
|
||||||
|
|
||||||
Return detected partitions as a list of structs. See
|
Return detected partitions as a list of structs. See
|
||||||
@@ -289,23 +293,25 @@ chosen. Relies on the `duf' command."
|
|||||||
:percent percent)))
|
:percent percent)))
|
||||||
partitions)))
|
partitions)))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions/df (mount-position)
|
(defun eshell-info-banner--get-mounted-partitions-df (mount-position)
|
||||||
"Get mounted partitions through df.
|
"Get mounted partitions through df.
|
||||||
Common function between
|
Common function between
|
||||||
`eshell-info-banner--get-mounted-partitions/gnu' and
|
`eshell-info-banner--get-mounted-partitions-gnu' and
|
||||||
`eshell-info-banner--get-mounted-partitions/darwing' which would
|
`eshell-info-banner--get-mounted-partitions-darwin' which would
|
||||||
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") (regexp-quote "\n") t)))
|
(let ((partitions (split-string (eshell-info-banner--shell-command-to-string "df -lH")
|
||||||
(-keep (lambda (partition)
|
(regexp-quote "\n")
|
||||||
|
t)))
|
||||||
|
(seq-filter (lambda (partition)
|
||||||
(let* ((partition (split-string partition " " t))
|
(let* ((partition (split-string partition " " t))
|
||||||
(filesystem (nth 0 partition))
|
(filesystem (nth 0 partition))
|
||||||
(size (nth 1 partition))
|
(size (nth 1 partition))
|
||||||
(used (nth 2 partition))
|
(used (nth 2 partition))
|
||||||
(percent (nth 4 partition))
|
(percent (nth 4 partition))
|
||||||
(mount (nth mount-position partition)))
|
(mount (nth mount-position partition)))
|
||||||
(when (seq-some (lambda (prefix)
|
(unless (seq-some (lambda (prefix)
|
||||||
(string-prefix-p prefix filesystem t))
|
(string-prefix-p prefix filesystem t))
|
||||||
eshell-info-banner-partition-prefixes)
|
eshell-info-banner-partition-prefixes)
|
||||||
(make-eshell-info-banner--mounted-partitions
|
(make-eshell-info-banner--mounted-partitions
|
||||||
@@ -318,15 +324,15 @@ MOUNT-POSITION."
|
|||||||
(string-trim-left percent (regexp-quote "%")))))))
|
(string-trim-left percent (regexp-quote "%")))))))
|
||||||
partitions)))
|
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.
|
||||||
|
|
||||||
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 `df' command."
|
chosen. Relies on the `df' command."
|
||||||
(eshell-info-banner--get-mounted-partitions/df 5))
|
(eshell-info-banner--get-mounted-partitions-df 5))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions/windows ()
|
(defun eshell-info-banner--get-mounted-partitions-windows ()
|
||||||
"Detect mounted partitions on a Windows system.
|
"Detect mounted partitions on a Windows system.
|
||||||
|
|
||||||
Return detected partitions as a list of structs. See
|
Return detected partitions as a list of structs. See
|
||||||
@@ -336,27 +342,27 @@ chosen."
|
|||||||
(warn "Partition detection for Windows and DOS not yet supported.")
|
(warn "Partition detection for Windows and DOS not yet supported.")
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions/darwin ()
|
(defun eshell-info-banner--get-mounted-partitions-darwin ()
|
||||||
"Detect mounted partitions on a Darwin/macOS system.
|
"Detect mounted partitions on a Darwin/macOS system.
|
||||||
|
|
||||||
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 `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 ()
|
(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)
|
||||||
@@ -394,9 +400,9 @@ For TEXT-PADDING and BAR-LENGTH, see the documentation of
|
|||||||
|
|
||||||
|
|
||||||
; Memory ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
; Memory ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defun eshell-info-banner--get-memory/gnu ()
|
(defun eshell-info-banner--get-memory-gnu ()
|
||||||
"Get memory usage for GNU/Linux and Hurd."
|
"Get memory usage for GNU/Linux and Hurd."
|
||||||
(-map (lambda (line)
|
(seq-do (lambda (line)
|
||||||
(let* ((line (split-string line " " t)))
|
(let* ((line (split-string line " " t)))
|
||||||
(list (s-chop-suffix ":" (nth 0 line)) ; name
|
(list (s-chop-suffix ":" (nth 0 line)) ; name
|
||||||
(string-to-number (nth 1 line)) ; total
|
(string-to-number (nth 1 line)) ; total
|
||||||
@@ -405,7 +411,7 @@ For TEXT-PADDING and BAR-LENGTH, see the documentation of
|
|||||||
"\n"
|
"\n"
|
||||||
t)))
|
t)))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-memory/unix ()
|
(defun eshell-info-banner--get-memory-unix ()
|
||||||
"Get memory usage for UNIX systems.
|
"Get memory usage for UNIX systems.
|
||||||
Compatible with Darwin and FreeBSD at least."
|
Compatible with Darwin and FreeBSD at least."
|
||||||
(let* ((command-to-mem (lambda (command)
|
(let* ((command-to-mem (lambda (command)
|
||||||
@@ -419,37 +425,7 @@ Compatible with Darwin and FreeBSD at least."
|
|||||||
,(apply command-to-mem '("sysctl hw.physmem"))
|
,(apply command-to-mem '("sysctl hw.physmem"))
|
||||||
,(apply command-to-mem '("sysctl hw.usermem"))))))
|
,(apply command-to-mem '("sysctl hw.usermem"))))))
|
||||||
|
|
||||||
(defalias 'eshell-info-banner--get-memory/bsd #'eshell-info-banner--get-memory/unix)
|
(defun eshell-info-banner--get-memory-windows ()
|
||||||
|
|
||||||
(defun eshell-info-banner--get-memory/darwin ()
|
|
||||||
"Get memory usage for macOS."
|
|
||||||
(let* ((mem (s-lines (eshell-info-banner--shell-command-to-string "vm_stat")))
|
|
||||||
(mem (cl-remove-if-not (lambda (line)
|
|
||||||
(string-match-p "^Pages \\(free\\|active\\|inactive\\|speculative\\|wired\\)"
|
|
||||||
line))
|
|
||||||
mem))
|
|
||||||
(mem (mapcar (lambda (line)
|
|
||||||
(save-match-data
|
|
||||||
(string-match "^Pages \\([[:alpha:] ]+\\): *\\([[:digit:]]+\\)\\." line)
|
|
||||||
`(,(substring-no-properties line
|
|
||||||
(match-beginning 1)
|
|
||||||
(match-end 1))
|
|
||||||
.
|
|
||||||
,(string-to-number (substring-no-properties line
|
|
||||||
(match-beginning 2)
|
|
||||||
(match-end 2))))))
|
|
||||||
mem))
|
|
||||||
(total (cl-reduce (lambda (acc val)
|
|
||||||
(+ acc (cdr val)))
|
|
||||||
mem
|
|
||||||
:initial-value 0))
|
|
||||||
(used (+ (cdr (assoc "active" mem))
|
|
||||||
(cdr (assoc "wired down" mem)))))
|
|
||||||
`(("RAM"
|
|
||||||
,(* 4096 total)
|
|
||||||
,(* 4096 used)))))
|
|
||||||
|
|
||||||
(defun eshell-info-banner--get-memory/windows ()
|
|
||||||
"Get memory usage for Window."
|
"Get memory usage for Window."
|
||||||
(warn "Memory usage not yet implemented for Windows and DOS")
|
(warn "Memory usage not yet implemented for Windows and DOS")
|
||||||
nil)
|
nil)
|
||||||
@@ -464,13 +440,11 @@ total amount of memory available, and the amount of used memory,
|
|||||||
in bytes."
|
in bytes."
|
||||||
(pcase system-type
|
(pcase system-type
|
||||||
((or 'gnu 'gnu/linux)
|
((or 'gnu 'gnu/linux)
|
||||||
(eshell-info-banner--get-memory/gnu))
|
(eshell-info-banner--get-memory-gnu))
|
||||||
('gnu/kfreebsd
|
((or 'darwin 'berkeley-unix 'gnu/kfreebsd)
|
||||||
(eshell-info-banner--get-memory/bsd))
|
(eshell-info-banner--get-memory-unix))
|
||||||
((or 'darwin 'berkeley-unix)
|
|
||||||
(eshell-info-banner--get-memory/unix))
|
|
||||||
((or 'ms-dos 'windows-nt 'cygwin)
|
((or 'ms-dos 'windows-nt 'cygwin)
|
||||||
(eshell-info-banner--get-memory/windows))
|
(eshell-info-banner--get-memory-windows))
|
||||||
(os (warn "Memory usage not yet implemented for %s" os)
|
(os (warn "Memory usage not yet implemented for %s" os)
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
@@ -633,7 +607,7 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
((string= "BuildLab" (match-string 1)) (setq win32-build (match-string 3)))))
|
((string= "BuildLab" (match-string 1)) (setq win32-build (match-string 3)))))
|
||||||
(format "%s (%s)" win32-name win32-build))))
|
(format "%s (%s)" win32-name win32-build))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-os-information/windows ()
|
(defun eshell-info-banner--get-os-information-windows ()
|
||||||
"See `eshell-info-banner--get-os-information'."
|
"See `eshell-info-banner--get-os-information'."
|
||||||
(let ((os (eshell-info-banner--get-os-information-from-registry)))
|
(let ((os (eshell-info-banner--get-os-information-from-registry)))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
@@ -646,7 +620,7 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
(match-beginning 2)
|
(match-beginning 2)
|
||||||
(match-end 2))))))
|
(match-end 2))))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-os-information/gnu ()
|
(defun eshell-info-banner--get-os-information-gnu ()
|
||||||
"See `eshell-info-banner--get-os-information'."
|
"See `eshell-info-banner--get-os-information'."
|
||||||
(let ((prefix (if eshell-info-banner-tramp-aware (file-remote-p default-directory) "")))
|
(let ((prefix (if eshell-info-banner-tramp-aware (file-remote-p default-directory) "")))
|
||||||
`(,(cond
|
`(,(cond
|
||||||
@@ -681,9 +655,9 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
,version)
|
,version)
|
||||||
,(cdr major)))
|
,(cdr major)))
|
||||||
eshell-info-banner--macos-versions)
|
eshell-info-banner--macos-versions)
|
||||||
(t "unkown version")))
|
(t "unknown version")))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-os-information/darwin ()
|
(defun eshell-info-banner--get-os-information-darwin ()
|
||||||
"See `eshell-info-banner--get-os-information'."
|
"See `eshell-info-banner--get-os-information'."
|
||||||
`(,(eshell-info-banner--get-macos-name (s-trim (eshell-info-banner--shell-command-to-string "sw_vers -productVersion")))
|
`(,(eshell-info-banner--get-macos-name (s-trim (eshell-info-banner--shell-command-to-string "sw_vers -productVersion")))
|
||||||
.
|
.
|
||||||
@@ -696,12 +670,12 @@ and second its kernel name and version (or in Windows’ case its
|
|||||||
build number)."
|
build number)."
|
||||||
(pcase system-type
|
(pcase system-type
|
||||||
((or 'ms-dos 'windows-nt 'cygwin)
|
((or 'ms-dos 'windows-nt 'cygwin)
|
||||||
(eshell-info-banner--get-os-information/windows))
|
(eshell-info-banner--get-os-information-windows))
|
||||||
((or 'gnu 'gnu/linux 'gnu/kfreebsd 'berkeley-unix)
|
((or 'gnu 'gnu/linux 'gnu/kfreebsd 'berkeley-unix)
|
||||||
(eshell-info-banner--get-os-information/gnu))
|
(eshell-info-banner--get-os-information-gnu))
|
||||||
('darwin
|
('darwin
|
||||||
(eshell-info-banner--get-os-information/darwin))
|
(eshell-info-banner--get-os-information-darwin))
|
||||||
(os (warn "Operating system information retrieving not yet supported for %s")
|
(os (warn "Operating system information retrieving not yet supported for %s" os)
|
||||||
'((format "%s") . "Unknown"))))
|
'((format "%s") . "Unknown"))))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user