5 Commits
0.7.2 ... 0.7.3

Author SHA1 Message Date
81181090df Bump version 2021-11-19 18:55:26 +01:00
0bd70d0d0f Fix df-related code 2021-11-19 18:38:24 +01:00
312f1e3da3 Update link in REAMDE 2021-11-15 10:14:29 +01:00
a43818569d Fix value type issue in `eshell-info-banner--get-memory-gnu' 2021-11-15 10:14:29 +01:00
517b9d705c Update README, package is now in melpa
Update recipes for installing package

Add MELPA badge
2021-11-15 10:14:29 +01:00
2 changed files with 35 additions and 38 deletions

View File

@@ -1,6 +1,8 @@
#+title: eshell-info-banner.el
#+author: Lucien Cartier-Tilet
#+email: lucien@phundrak.com
[[https://melpa.org/#/eshell-info-banner][file:https://melpa.org/packages/eshell-info-banner-badge.svg]]
* Introduction
~eshell-info-banner.el~ is a utility for creating an informative banner,
akin to ~fish_greeting~ but for Eshell. But an image is worth a thousand
@@ -32,7 +34,7 @@ macOS. PR are welcome if you want to fix that!
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~ |
@@ -60,12 +62,12 @@ your ~load-path~ and add the following to your ~.emacs~ or your ~init.el~:
(add-hook 'eshell-banner-load-hook 'eshell-info-banner-update-banner)
#+end_src
If you use ~use-package~ only, you can then install it like so:
If you use ~use-package~ only and install the package from MELPA, you
can then install it like so:
#+begin_src emacs-lisp
(use-package eshell-info-banner
:ensure t
:defer t
:load-path "~/path/to/where/you/cloned/it/eshell-info-banner.el/"
:hook (eshell-banner-load . eshell-info-banner-update-banner))
#+end_src
@@ -74,23 +76,17 @@ In my case, I prefer using ~use-package~ with ~straight~:
(use-package eshell-info-banner
:ensure t
:defer t
:straight (eshell-info-banner :type git
:host github
:repo "phundrak/eshell-info-banner.el")
:straight (:build t)
:hook (eshell-banner-load . eshell-info-banner-update-banner))
#+end_src
I personally also added ~:build t~ in the straight recipe to ensure
Emacs compiles my package, both to ~.elc~ and ~.eln~ files (I am on Emacs
28.0, ~feature/native-comp~ got merged into ~master~!)
You can just use ~:straight t~ if you do not want to ensure the package
gets compiled by Emacs.
There is probably a similar way to install it with pure ~straight.el~ or
~quelpa~, but Im not knowledgable enough for that, feel free to create
a PR to add some more installation instructions!
There is currently no plans of making this package available on MELPA
or non-gnu elpa.
* Customizing
A couple of variables can be edited by the user in order to configure
~eshell-info-banner.el~:
@@ -181,4 +177,4 @@ See [[file:CONTRIBUTING.org]].
* License
~eshell-info-banner.el~ is available under the GNU GPL-3.0 license. You
can find the full text in [[file:LICENSE.md][LICENSE.md]].
can find the full text in the [[file:LICENSE][LICENSE]] file.

View File

@@ -2,7 +2,7 @@
;; Author: Lucien Cartier-Tilet <lucien@phundrak.com>
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
;; Version: 0.7.1
;; Version: 0.7.3
;; Package-Requires: ((emacs "25.1") (f "0.20") (s "1"))
;; Homepage: https://labs.phundrak.com/phundrak/eshell-info-banner.el
@@ -301,17 +301,18 @@ Common function between
otherwise differ solely on the position of the mount point in the
partition list. Its position is given by the argument
MOUNT-POSITION."
(let ((partitions (split-string (eshell-info-banner--shell-command-to-string "df -lH")
(let ((partitions (cdr (split-string (eshell-info-banner--shell-command-to-string "df -lH")
(regexp-quote "\n")
t)))
(seq-filter (lambda (partition)
t))))
(cl-remove-if #'null
(mapcar (lambda (partition)
(let* ((partition (split-string partition " " t))
(filesystem (nth 0 partition))
(size (nth 1 partition))
(used (nth 2 partition))
(percent (nth 4 partition))
(mount (nth mount-position partition)))
(unless (seq-some (lambda (prefix)
(when (seq-some (lambda (prefix)
(string-prefix-p prefix filesystem t))
eshell-info-banner-partition-prefixes)
(make-eshell-info-banner--mounted-partitions
@@ -322,7 +323,7 @@ MOUNT-POSITION."
:used used
:percent (string-to-number
(string-trim-left percent (regexp-quote "%")))))))
partitions)))
partitions))))
(defun eshell-info-banner--get-mounted-partitions-gnu ()
"Detect mounted partitions on a Linux system.
@@ -402,7 +403,7 @@ For TEXT-PADDING and BAR-LENGTH, see the documentation of
; Memory ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun eshell-info-banner--get-memory-gnu ()
"Get memory usage for GNU/Linux and Hurd."
(seq-do (lambda (line)
(mapcar (lambda (line)
(let* ((line (split-string line " " t)))
(list (s-chop-suffix ":" (nth 0 line)) ; name
(string-to-number (nth 1 line)) ; total