Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
27b0be266b | |||
663d531003 | |||
56c31d79ff |
46
.github/workflows/workflow.yml
vendored
Normal file
46
.github/workflows/workflow.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-compatibility:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
emacs_version:
|
||||||
|
- 25.1
|
||||||
|
- 25.2
|
||||||
|
- 25.3
|
||||||
|
- 26.1
|
||||||
|
- 26.2
|
||||||
|
- 26.3
|
||||||
|
- 27.1
|
||||||
|
- 27.2
|
||||||
|
- 28.1
|
||||||
|
- snapshot
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: purcell/setup-emacs@master
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.emacs_version }}
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: cache-cask-packages
|
||||||
|
with:
|
||||||
|
path: .cask
|
||||||
|
key: cache-cask-packages-000
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: cache-cask-executable
|
||||||
|
with:
|
||||||
|
path: ~/.cask
|
||||||
|
key: cache-cask-executable-000
|
||||||
|
- name: "Cask setup"
|
||||||
|
uses: cask/setup-cask@master
|
||||||
|
if: steps.cask-cache-executable.outputs.cache-hit != 'true'
|
||||||
|
- name: "Install Cask dependencies"
|
||||||
|
run: cask install
|
||||||
|
if: steps.cask-cache-executable.outputs.cache-hit != 'true'
|
||||||
|
- name: "Check version compatibility"
|
||||||
|
run: make all
|
7
Cask
Normal file
7
Cask
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
(source melpa)
|
||||||
|
(source gnu)
|
||||||
|
|
||||||
|
(package-file "eshell-info-banner.el")
|
||||||
|
|
||||||
|
(development
|
||||||
|
(depends-on "s"))
|
11
Makefile
Normal file
11
Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# -*- indent-tabs-mode: t -*-
|
||||||
|
|
||||||
|
export EMACS ?= $(shell which emacs)
|
||||||
|
CASK ?= $(shell which cask)
|
||||||
|
|
||||||
|
all: compile
|
||||||
|
|
||||||
|
compile:
|
||||||
|
${CASK} exec ${EMACS} -Q --script bin/compile-package.el 2>&1 | grep -A 2 -E "([Ee]rror|[Ww]arning):" && exit 1 || exit 0
|
||||||
|
|
||||||
|
.PHONY: all compile
|
@ -3,6 +3,7 @@
|
|||||||
#+email: lucien@phundrak.com
|
#+email: lucien@phundrak.com
|
||||||
[[https://melpa.org/#/eshell-info-banner][file:https://melpa.org/packages/eshell-info-banner-badge.svg]]
|
[[https://melpa.org/#/eshell-info-banner][file:https://melpa.org/packages/eshell-info-banner-badge.svg]]
|
||||||
[[https://stable.melpa.org/#/eshell-info-banner][file:https://stable.melpa.org/packages/eshell-info-banner-badge.svg]]
|
[[https://stable.melpa.org/#/eshell-info-banner][file:https://stable.melpa.org/packages/eshell-info-banner-badge.svg]]
|
||||||
|
[[https://github.com/Phundrak/eshell-info-banner.el/actions/workflows/workflow.yml][file:https://github.com/Phundrak/eshell-info-banner.el/actions/workflows/workflow.yml/badge.svg]]
|
||||||
|
|
||||||
* Introduction
|
* Introduction
|
||||||
~eshell-info-banner.el~ is a utility for creating an informative banner,
|
~eshell-info-banner.el~ is a utility for creating an informative banner,
|
||||||
|
1
bin/compile-package.el
Normal file
1
bin/compile-package.el
Normal file
@ -0,0 +1 @@
|
|||||||
|
(byte-recompile-directory "." 0 'force)
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
;; 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.8.7
|
;; Version: 0.8.8
|
||||||
;; Package-Requires: ((emacs "25.1") (s "1"))
|
;; Package-Requires: ((emacs "25.1") (s "1"))
|
||||||
;; Homepage: https://github.com/Phundrak/eshell-info-banner.el
|
;; Homepage: https://github.com/Phundrak/eshell-info-banner.el
|
||||||
|
|
||||||
@ -38,7 +38,7 @@
|
|||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'f)
|
(require 's)
|
||||||
(require 'em-banner)
|
(require 'em-banner)
|
||||||
(require 'json)
|
(require 'json)
|
||||||
(require 'seq)
|
(require 'seq)
|
||||||
@ -139,18 +139,19 @@
|
|||||||
:group 'eshell-info-banner
|
:group 'eshell-info-banner
|
||||||
:type 'list)
|
:type 'list)
|
||||||
|
|
||||||
(defun eshell-info-banner--executable-find (program)
|
|
||||||
|
(defmacro eshell-info-banner--executable-find (program)
|
||||||
"Find PROGRAM executable, possibly on a remote machine.
|
"Find PROGRAM executable, possibly on a remote machine.
|
||||||
This is a wrapper around `executable-find' in order to avoid
|
This is a wrapper around `executable-find' in order to avoid
|
||||||
issues with older versions of the functions only accepting one
|
issues with older versions of the functions only accepting one
|
||||||
argument. `executable-find'’s remote argument has the value of
|
argument. `executable-find'’s remote argument has the value of
|
||||||
`eshell-info-banner-tramp-aware'."
|
`eshell-info-banner-tramp-aware'."
|
||||||
(if (version< emacs-version "27.1")
|
(if (version< emacs-version "27.1")
|
||||||
(let ((default-directory (if eshell-info-banner-tramp-aware
|
`(let ((default-directory (if eshell-info-banner-tramp-aware
|
||||||
default-directory
|
default-directory
|
||||||
"~")))
|
"~")))
|
||||||
(executable-find program))
|
(executable-find ,program))
|
||||||
(executable-find program eshell-info-banner-tramp-aware)))
|
`(executable-find ,program eshell-info-banner-tramp-aware)))
|
||||||
|
|
||||||
(defcustom eshell-info-banner-duf-executable "duf"
|
(defcustom eshell-info-banner-duf-executable "duf"
|
||||||
"Path to the `duf' executable."
|
"Path to the `duf' executable."
|
||||||
@ -265,11 +266,11 @@ If the executable `uptime' is not found, return nil."
|
|||||||
(if (not (seq-some (lambda (keyword)
|
(if (not (seq-some (lambda (keyword)
|
||||||
(string-match-p keyword uptime-str))
|
(string-match-p keyword uptime-str))
|
||||||
'("invalid" "illegal" "unknown")))
|
'("invalid" "illegal" "unknown")))
|
||||||
(s-chop-prefix "up " (string-trim uptime-str))
|
(s-chop-prefix "up " (s-trim uptime-str))
|
||||||
(let ((uptime-str (eshell-info-banner--shell-command-to-string "uptime")))
|
(let ((uptime-str (eshell-info-banner--shell-command-to-string "uptime")))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(string-match "[^,]+up *\\([^,]+\\)," uptime-str)
|
(string-match "[^,]+up *\\([^,]+\\)," uptime-str)
|
||||||
(string-trim (substring-no-properties uptime-str
|
(s-trim (substring-no-properties uptime-str
|
||||||
(match-beginning 1)
|
(match-beginning 1)
|
||||||
(match-end 1)))))))))
|
(match-end 1)))))))))
|
||||||
|
|
||||||
@ -387,7 +388,7 @@ MOUNT-POSITION."
|
|||||||
:size size
|
:size size
|
||||||
:used used
|
:used used
|
||||||
:percent (string-to-number
|
:percent (string-to-number
|
||||||
(string-trim-left percent (regexp-quote "%")))))))
|
(s-chop-suffix "%" percent))))))
|
||||||
partitions))))
|
partitions))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions-gnu ()
|
(defun eshell-info-banner--get-mounted-partitions-gnu ()
|
||||||
@ -477,7 +478,7 @@ For TEXT-PADDING and BAR-LENGTH, see the documentation of
|
|||||||
"Get the output of COMMAND corresponding to memory information.
|
"Get the output of COMMAND corresponding to memory information.
|
||||||
This function is to be only used on platforms which support sysctl."
|
This function is to be only used on platforms which support sysctl."
|
||||||
(string-to-number
|
(string-to-number
|
||||||
(string-trim
|
(s-trim
|
||||||
(car (last
|
(car (last
|
||||||
(split-string (eshell-info-banner--shell-command-to-string command)
|
(split-string (eshell-info-banner--shell-command-to-string command)
|
||||||
" "
|
" "
|
||||||
@ -489,7 +490,7 @@ See `eshell-info-banner--get-memory'."
|
|||||||
(let* ((total (eshell-info-banner--get-memory-unix-command-to-mem "sysctl hw.physmem64"))
|
(let* ((total (eshell-info-banner--get-memory-unix-command-to-mem "sysctl hw.physmem64"))
|
||||||
(used (- total
|
(used (- total
|
||||||
(* 1024 (string-to-number
|
(* 1024 (string-to-number
|
||||||
(string-trim
|
(s-trim
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents-literally "/proc/meminfo")
|
(insert-file-contents-literally "/proc/meminfo")
|
||||||
(save-match-data
|
(save-match-data
|
||||||
@ -733,7 +734,7 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
(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
|
||||||
(string-match "\\([^()]+\\) *(\\([^()]+\\))" os)
|
(string-match "\\([^()]+\\) *(\\([^()]+\\))" os)
|
||||||
`(,(string-trim (substring-no-properties os
|
`(,(s-trim (substring-no-properties os
|
||||||
(match-beginning 1)
|
(match-beginning 1)
|
||||||
(match-end 1)))
|
(match-end 1)))
|
||||||
.
|
.
|
||||||
@ -747,7 +748,7 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
`(,(cond
|
`(,(cond
|
||||||
;; Bedrock Linux
|
;; Bedrock Linux
|
||||||
((file-exists-p (concat prefix "/bedrock/etc/bedrock-release"))
|
((file-exists-p (concat prefix "/bedrock/etc/bedrock-release"))
|
||||||
(string-trim (with-temp-buffer
|
(s-trim (with-temp-buffer
|
||||||
(insert-file-contents (concat prefix "/bedrock/etc/bedrock-release"))
|
(insert-file-contents (concat prefix "/bedrock/etc/bedrock-release"))
|
||||||
(buffer-string))))
|
(buffer-string))))
|
||||||
;; Proxmox
|
;; Proxmox
|
||||||
@ -775,16 +776,16 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
(match-end 1))))))
|
(match-end 1))))))
|
||||||
((equal system-type 'gnu/kfreebsd)
|
((equal system-type 'gnu/kfreebsd)
|
||||||
(let* ((default-directory (if eshell-info-banner-tramp-aware default-directory "~")))
|
(let* ((default-directory (if eshell-info-banner-tramp-aware default-directory "~")))
|
||||||
(string-trim (with-temp-buffer
|
(s-trim (with-temp-buffer
|
||||||
(process-file "uname" nil t nil "-s")
|
(process-file "uname" nil t nil "-s")
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
((and (file-exists-p (concat prefix "/system/app"))
|
((and (file-exists-p (concat prefix "/system/app"))
|
||||||
(file-exists-p (concat prefix "/system/priv-app")))
|
(file-exists-p (concat prefix "/system/priv-app")))
|
||||||
(concat "Android "
|
(concat "Android "
|
||||||
(string-trim (eshell-info-banner--shell-command-to-string "getprop ro.build.version.release"))))
|
(s-trim (eshell-info-banner--shell-command-to-string "getprop ro.build.version.release"))))
|
||||||
(t "Unknown"))
|
(t "Unknown"))
|
||||||
.
|
.
|
||||||
,(string-trim (eshell-info-banner--shell-command-to-string "uname -rs")))))
|
,(s-trim (eshell-info-banner--shell-command-to-string "uname -rs")))))
|
||||||
|
|
||||||
(defmacro eshell-info-banner--get-macos-name (version)
|
(defmacro eshell-info-banner--get-macos-name (version)
|
||||||
"Get the name of the current macOS or OSX system based on its VERSION."
|
"Get the name of the current macOS or OSX system based on its VERSION."
|
||||||
@ -799,10 +800,10 @@ If RELEASE-FILE is nil, use '/etc/os-release'."
|
|||||||
(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
|
`(,(eshell-info-banner--get-macos-name
|
||||||
(string-trim
|
(s-trim
|
||||||
(eshell-info-banner--shell-command-to-string "sw_vers -productVersion")))
|
(eshell-info-banner--shell-command-to-string "sw_vers -productVersion")))
|
||||||
.
|
.
|
||||||
,(string-trim (eshell-info-banner--shell-command-to-string "uname -rs"))))
|
,(s-trim (eshell-info-banner--shell-command-to-string "uname -rs"))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-os-information ()
|
(defun eshell-info-banner--get-os-information ()
|
||||||
"Get operating system identifying information.
|
"Get operating system identifying information.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user