From a7b0439aebb8943b9ae241e0ec184656d0254a70 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 26 Jan 2020 22:08:57 +0200 Subject: [PATCH] pfetch: Added PF_SOURCE. Closes #34 --- README.md | 5 +++++ pfetch | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index df4462a..49b8d5d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,11 @@ PF_INFO="ascii" # Example: Only Information. PF_INFO="title os host kernel uptime pkgs memory" +# A file to source before running pfetch. +# Default: unset +# Valid: A shell script +PF_SOURCE="" + # Separator between info name and info data. # Default: unset # Valid: string diff --git a/pfetch b/pfetch index 77ee310..2311f16 100755 --- a/pfetch +++ b/pfetch @@ -1296,6 +1296,11 @@ main() { # This gives full control over what it displayed on the screen. exec 6>&1 >/dev/null + # Allow the user to execute their own script and modify or + # extend pfetch's behavior. + # shellcheck source=/dev/null + . "${PF_SOURCE:-/dev/null}" ||: + # Ensure that the 'TMPDIR' is writable as heredocs use it and # fail without the write permission. This was found to be the # case on Android where the temporary directory requires root.