1. 21 Oct, 2021 2 commits
  2. 14 Oct, 2021 1 commit
    • Slobodan Todorov's avatar
      Add option to choose which battery status to get · ef944b41
      Slobodan Todorov authored
      When ACPI returns multiple batteries, and not all of them related to laptop
      battery, this option can be used to specify which battery to be used for
      status information. Example of this is Logitech Unifying Receiver, returning
      battery information for keyboard/mouse.
      ef944b41
  3. 07 Oct, 2021 1 commit
    • Mark Vander Stel's avatar
      Remove ubuntu-16.04 env from tests · f89a4274
      Mark Vander Stel authored
      Github has removed this version of Ubuntu VM, as it is no longer
      supported by the upstream.
      
      Change the targets to the rolling versions of "latest", to prevent
      needing to make these changes again. My original logic was to run on as
      many OSs as possible, but in reality all of these versions act so
      similar in terms of shell functionality that it is kinda pointless. One
      VM of each OS should be fine.
      f89a4274
  4. 05 Oct, 2021 1 commit
  5. 28 Aug, 2021 1 commit
  6. 27 Aug, 2021 3 commits
  7. 24 Aug, 2021 1 commit
  8. 22 Aug, 2021 1 commit
  9. 12 Aug, 2021 1 commit
    • Mark Vander Stel's avatar
      Add Kubernetes context default namespace · b6a1f24c
      Mark Vander Stel authored
      Add data gathering for the configured default namespace of the current
      kubectl context. Display that data as a string directly after the
      context string, separated by a colon.
      
      While this is a separate chunk of data from the context, it is actually
      part of the context definition, and so it makes sense to display it
      along with the context.
      
      While most Kubernetes objects are subject to the strict DNS name
      restrictions, kubectl contexts never have their name server-side, and so
      do not have the same restrictions. This means a context name can include
      any characters, meaning we have no safe way to parse it out of a data
      string. I wanted to use:
      
      line=$(kubectl config view --minify --output 'jsonpath={.current-context}{" "}{..namespace}')
      IFS=' ' read kubernetes_context kubernetes_namespace <<<"$line"
      
      But since spaces can be in a context name, this would break.
      b6a1f24c
  10. 29 Jul, 2021 4 commits
    • Mark Vander Stel's avatar
      Refactor hooks · 0ce76465
      Mark Vander Stel authored
      Hooks have always been a mess. There was no organization when they were
      added, as when the project first started there was no need for them.
      
      To make things consistent, break out disabling hooks into
      __lp_disable_hooks(), and make prompt_on() be the enabler of hooks. Then
      have lp_activate() disable hooks at the start, and enable hooks at the
      end.
      
      Some small changes around how state is detected, but no functional
      difference here.
      0ce76465
    • Mark Vander Stel's avatar
      Stop squashing Zsh prompt options · 58969b20
      Mark Vander Stel authored
      Based on the work done in ecdde384, the
      prompt_bang and prompt_subst options, which handle '!' and '$'/'`'
      characters respectively, can be left untouched. When running
      __lp_escape(), those options are checked, and if set, their characters
      are escaped.
      
      prompt_percent however, must still be enabled always. The shell sequence
      escapes, '%{' and '%}' only work when the option is enabled. Maybe
      someday we can detect when the option is off and disable all terminal
      formatting, but it doesn't seem worth the effort.
      
      Backslashes must be escaped even on Zsh to prevent confusion with a
      backslash directly preceding a character that would give is special
      meaning.
      58969b20
    • Mark Vander Stel's avatar
      Fix bash __lp_escape() for backtick expansion · a1d0a540
      Mark Vander Stel authored
      For some reason, Bash ignores a '\$' sequence when the promptvars option
      is off, printing it as '$'. It does not do the same for a backtick
      escaped: '\`' is printed as '\`'. To prevent this issue, detect if the
      option is on, and if so, escape both '$' and '`'.
      
      Running 'shopt' is actually faster than either a [[ ]] or (( ))
      expression.
      a1d0a540
    • Mark Vander Stel's avatar
      e3eb48ba
  11. 06 Jul, 2021 2 commits
  12. 28 Jun, 2021 2 commits
  13. 15 Jun, 2021 1 commit
    • Mark Vander Stel's avatar
      Add missing Ruby VENV template section in docs · 486cf147
      Mark Vander Stel authored
      This was missed in the PR for the Ruby Virtualenv section.
      The order in the docs for Terraform and Kubecontext was backwards from
      the order in the code.
      Moved parts of the PS1 building to different lines to make it easier to
      read and add new sections.
      
      Resolves #676
      486cf147
  14. 14 Jun, 2021 2 commits
  15. 30 May, 2021 2 commits
  16. 09 May, 2021 1 commit
    • Mark Vander Stel's avatar
      Fix temperature erroring if tool returns no data · 4c81ef40
      Mark Vander Stel authored
      Rarely, sensors or acpi can return no temperature data. In this case,
      the data function would return false and 0, but the detect function
      would error if set -u was enabled.
      
      Harden all of the four temperature functions against this, and greatly
      increase the test coverage to cover these four functions, as well as
      adding a specific case for the tools returning no data.
      
      This also allows for the temperature functions to return values less
      than 0, if somehow a device has all temp sensors returning less than
      that.
      
      Mention in the function documentation that it is possible for the
      function to return a not set string.
      
      Fixes 670
      4c81ef40
  17. 02 May, 2021 3 commits
  18. 28 Apr, 2021 4 commits
  19. 27 Apr, 2021 6 commits
    • Mark Vander Stel's avatar
      Fix array issue in powerlines in Bash-3.2 · 77dc561c
      Mark Vander Stel authored
      In random older versions of Bash, accessing arrays when set -u is set
      will crash or return incorrect values. This is a continuation of commit
      e121179d, but for the powerline themes.
      77dc561c
    • Mark Vander Stel's avatar
      Fix local bug in Zsh-5.0 · 7db4ada7
      Mark Vander Stel authored
      Zsh 5.0 continues to be a huge pain. As noted in the shell wiki, all
      variables assigned to another variable as part of a 'local' or 'typeset'
      line must be quoted, or things will break. The reason I caught these
      many instances was a failing test on Zsh-5.0.8 because of the bad line
      in __lp_pwd_tilde().
      7db4ada7
    • Mark Vander Stel's avatar
      Fix bug in powerlines for Zsh and Bash-3.2 · 70ce708b
      Mark Vander Stel authored
      Undeclared local variables are the worst. When declaring a local
      variable, Zsh treats it as set (to the empty) string, while Bash (more
      correctly, in my opinion) treats it as unset. This meant that this check
      of if the first powerline section had happened yet would always return
      true on Zsh, showing an ugly arrow at the start of the prompt. On
      Bash-3.2 (with set -u) it would just crash, which is how I noticed the
      bug.
      
      The solution is to never rely on a local being set or not, but to look
      at the actual value. In this case check for the empty string (with a set
      -u safety).
      70ce708b
    • Mark Vander Stel's avatar
      Modify test script to accept shells as arguments · 9a2c0670
      Mark Vander Stel authored
      While not useful in CI scripts, this lets a developer run the tests
      against their own shells if they wish.
      
      I tested this with:
      bash 3.2.0(1)-release (x86_64-unknown-linux-gnu)
      bash 4.0.28(2)-release (x86_64-unknown-linux-gnu)
      bash 4.2.53(1)-release (x86_64-unknown-linux-gnu)
      bash 4.4.0(1)-release (x86_64-unknown-linux-gnu)
      bash 4.4.19(1)-release (x86_64-unknown-linux-gnu)
      bash 5.0.17(1)-release (x86_64-pc-linux-gnu)
      bash 5.1.0(1)-release (x86_64-pc-linux-gnu)
      zsh 5.0.8 (x86_64-unknown-linux-gnu)
      zsh 5.1.1 (x86_64-unknown-linux-gnu)
      zsh 5.2 (x86_64-unknown-linux-gnu)
      zsh 5.3.1 (x86_64-unknown-linux-gnu)
      zsh 5.4.2 (x86_64-unknown-linux-gnu)
      zsh 5.5.1 (x86_64-redhat-linux-gnu)
      zsh 5.8 (x86_64-pc-linux-gnu)
      
      I found a few bugs, fixed in the following commits.
      9a2c0670
    • Mark Vander Stel's avatar
      Add included themes to theme preview tests · 3b751856
      Mark Vander Stel authored
      While (again) running the theme preview script does not really test that
      it is working, nor does it do like the old test script did and actually
      validate that output of the themes are what we expect, it will now catch
      runtime errors, which could be incredibly helpful.
      3b751856
    • Mark Vander Stel's avatar
      Merge branch 'title-escape-fix' · 83bbcc77
      Mark Vander Stel authored
      83bbcc77
  20. 20 Apr, 2021 1 commit
    • Mark Vander Stel's avatar
      Fix Zsh crash on rbenv output parse · fee75427
      Mark Vander Stel authored
      Parameter substitution is (like most standards) weakly defined, and here
      is a case where it was not tested on Zsh. Simple fix of wrapping the
      whole string (the '(' was the bad character) in quotes.
      
      Also add a test case to catch a regression.
      
      Fixes #667
      fee75427