1. 15 Mar, 2022 4 commits
    • Mark Vander Stel's avatar
      Update CHANGELOG and CONTRIBUTORS · f6a841c2
      Mark Vander Stel authored
      f6a841c2
    • Mark Vander Stel's avatar
      Merge branch 'Mice7R:feature/sudo-v' · a3479d3c
      Mark Vander Stel authored
      PR #702
      a3479d3c
    • Mice7R's avatar
      Remove SUDO_VALIDATE and only use sudo -v · a8147523
      Mice7R authored
      This addresses the changes requested by Rycieos at #702.
      To summarize:
      The flag -v exists since first version of sudo and we can't find a
      reason why to use true.
      
      This commit changes the default behaviour of sudo detection to use
      sudo -v instead of executing true.
      a8147523
    • Mice7R's avatar
      Add option LP_USE_SUDO_VALIDATE · d159831d
      Mice7R authored
      Validation of sudo credentials is done by invoking a command (true).
      This means that, if the user has sudo credentials, a root session is
      opened and then closed. Potentially generating two PAM messages plus the
      sudo line for true being executed as root.
      
      This commit adds an option to use the validate command (sudo -v) to test
      for credentials.
      Validate command DOES NOT open a session and does not log anything on
      success.
      It still logs "a password is required" in case of failure but those
      lines are easier to filter out searching for COMMAND=validate.
      
      I've opted for adding LP_USE_SUDO_VALIDATE instead of replacing the
      default behaviour because I'm not sure if -v is on every system.
      The default value is 0: using the old behaviour (execute true).
      d159831d
  2. 09 Mar, 2022 1 commit
    • Mark Vander Stel's avatar
      Add config option for changing hg command · 10cd6af1
      Mark Vander Stel authored
      Mercurial is written in Python 2, so it was always slow. There is work
      ongoing to rewrite it in Rust, but as the replacement is not at feature
      pairity yet, they are shipping the binary as 'rhg'. Since some might
      want to use different binaries for different things, give a config
      option to pick which binary to use for prompt data gathering.
      
      Resolves #701
      10cd6af1
  3. 08 Feb, 2022 2 commits
    • Mark Vander Stel's avatar
      83d98f0d
    • Mark Vander Stel's avatar
      Fix slowdown from undefined VCS functions · 4adbbf2c
      Mark Vander Stel authored
      Without these functions defined, each prompt invocation would force the
      shell to check if the command was valid, and generate an error message
      if it was not. We know that it won't be, so we can shortcut that by
      setting it as such.
      
      More importantly, if the Bash function command_not_found_handle() is
      set, it will be executed for each function that is not set. For Git or
      HG, this is only one. But for SVN, it is enough to lock the prompt for a
      while.
      
      Fixes #696
      4adbbf2c
  4. 31 Jan, 2022 1 commit
  5. 05 Jan, 2022 1 commit
    • Mark Vander Stel's avatar
      Update and fix documentation · cfad0e3f
      Mark Vander Stel authored
      The documentation libraries were out of date.
      Fix the Ubuntu version badge, since the version used is no longer
      supported upstream, and therefore has no badge. 22.04 isn't actually
      released yet, but already exists and has a badge, and will exist for a
      long time as a LTS.
      Fix a typo.
      cfad0e3f
  6. 13 Dec, 2021 1 commit
    • Mark Vander Stel's avatar
      Fix picking acpi battery backend when invalid · 9d27a43b
      Mark Vander Stel authored
      With the removal of the command -v check, anything returned on stdout
      would make acpi be a valid backend. This can happen in the
      command_not_found_handle() function is defined.
      
      Also don't pick a backend if the data function returns an error code.
      
      Further strictness could be to check that the string returned is a valid
      int, but that is probably overkill.
      
      Fixes #690
      9d27a43b
  7. 06 Dec, 2021 1 commit
  8. 04 Dec, 2021 2 commits
    • Mark Vander Stel's avatar
      Fix zsh glob error · 6ef456d7
      Mark Vander Stel authored
      Zsh by default will error if a glob matches nothing (a smart default).
      We need it to not error, and even better, to not use the Bash default of
      using the pattern. Set nullglob to expand it to nothing.
      
      Don't set the Bash version of nullglob in liquidprompt, since Bash
      doesn't do local options well, and not at all until version 4.4. It is
      safe to expand to a single string with the "*" in it, since the first
      check we do is for the file existing, which it will not.
      
      Add the sysfs power supply interface to the external-tool-tester.sh.
      6ef456d7
    • Slobodan Todorov's avatar
      Update battery functionality to add sysfs backend · 2c04232c
      Slobodan Todorov authored
      
      
      Add sysfs function, tests, and documentation.
      Set sysfs method as default.
      Remove LP_BATTERY_ID from __lp_battery_acpi() as unreliable.
      Co-authored-by: default avatarMark Vander Stel <mvndrstl@gmail.com>
      2c04232c
  9. 09 Nov, 2021 1 commit
    • Mark Vander Stel's avatar
      Fix broken links in documentation · 40fe15ee
      Mark Vander Stel authored
      Zinit has a new home; its old home was deleted.
      
      Debian seems to not have images for stable anymore on repology.org. I am
      not sure if this is a bug or not, but unstable has the latest packages
      anyway, so switch to that.
      40fe15ee
  10. 29 Oct, 2021 2 commits
  11. 21 Oct, 2021 2 commits
  12. 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
  13. 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
  14. 05 Oct, 2021 1 commit
  15. 28 Aug, 2021 1 commit
  16. 27 Aug, 2021 3 commits
  17. 24 Aug, 2021 1 commit
  18. 22 Aug, 2021 1 commit
  19. 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
  20. 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
  21. 06 Jul, 2021 2 commits
  22. 28 Jun, 2021 2 commits
  23. 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
  24. 14 Jun, 2021 2 commits
  25. 30 May, 2021 1 commit