Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

[Discussion] Minimum System Requirements #877

Closed
dritter opened this issue Jun 17, 2018 · 6 comments
Closed

[Discussion] Minimum System Requirements #877

dritter opened this issue Jun 17, 2018 · 6 comments

Comments

@dritter
Copy link
Member

dritter commented Jun 17, 2018

We never specified any minimum system requirements, but there are implicit requirements. Besides ZSH being the biggest part of this, I didn't want to constrain it to ZSH only.

  • functions/colors.zsh need at least ZSH 5.1
  • Conditionals like [[ -v "VARIABLE" ]] (found here) to test if a variable is declared need at least ZSH 5.3. Workaround is to use our own defined from functions/utilities.zsh. I we decide to go with ZSH 5.3, we could deprecate our defined function.

I am sure there are others. I just wanted to collect my findings so we could set up a wiki page. Also, it is important to know what ZSH versions we should test.

@onaforeignshore
Copy link
Contributor

@bhilburn Any thoughts on this? Would be nice to know what the minimum is as it affects not only coding, but also testing

@bhilburn
Copy link
Member

Yup, I think this is a great idea. We should for sure do this for v0.7.0.

@onaforeignshore - You have a great point re: testing. Let's settle on our minimum reqs, here, and then make sure we are testing against that (as well as the latest).

So, generally, I like using Ubuntu 16.04 LTS as a good benchmark for minimum requirements, which ships ZSH 5.1.1 by default (see here) - so I think we have to keep our own defined, for now. Once 18.04 LTS matures a bit and starts to displace 16.04, we can chat about bumping it up.

What else should we cover? Also, it would be good to test for minimum requirements at init and issue an error if they aren't present.

@dritter
Copy link
Member Author

dritter commented Jul 10, 2018

Too late to keep 5.1. At least for the battery segment.. To keep that, we should rework that condition to use our defined function.

Other minimum requirements we should document are git, mercurial, svn.. In other words: we should look at every segment and document the minimum version of the used programs, especially segments that make heavy use of other programs like VCS- , battery- and other segments.

@robobenklein
Copy link
Contributor

At least for the [[ -v from the battery segment, is there anything wrong with using (( ${+POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD} )) instead of [[ -v POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]] ?

@robobenklein
Copy link
Contributor

This is what appears to work for me:

diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c1ea754..8b2a217 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -498,7 +498,7 @@ prompt_battery() {
     fi
   fi
   # return if POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD is set and the battery percentage is greater or equal
-  if [[ -v "POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD" && "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then
+  if (( ${+POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD} )) && [[ "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then
     return
   fi

@dritter
Copy link
Member Author

dritter commented Sep 13, 2018

Closing this, cause we now have that documented in the wiki.

@dritter dritter closed this as completed Sep 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants