diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-07-18 23:24:25 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-07-18 23:24:25 +0300 |
commit | e99c7549fb330aa36f2912e1f0ace0081c26efd7 (patch) | |
tree | c9a0bc065e97b11e65b661d909f11350338d84ca /powerlevel9k.zsh-theme | |
parent | 1e71d452e1f20568ed83f9d86fda63ba58643bad (diff) |
Change ram segment to take an optional root prefix for testability
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 1983b031..2b68b6a4 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1241,6 +1241,7 @@ prompt_php_version() { ################################################################ # Segment to display free RAM and used Swap prompt_ram() { + local ROOT_PREFIX="${4}" local base='' local ramfree=0 if [[ "$OS" == "OSX" ]]; then @@ -1252,9 +1253,9 @@ prompt_ram() { ramfree=$(( ramfree * 4096 )) else if [[ "$OS" == "BSD" ]]; then - ramfree=$(grep 'avail memory' /var/run/dmesg.boot | awk '{print $4}') + ramfree=$(grep 'avail memory' ${ROOT_PREFIX}/var/run/dmesg.boot | awk '{print $4}') else - ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") + ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" ${ROOT_PREFIX}/proc/meminfo | grep -o -E "[0-9]+") base='K' fi fi |