1. 21 Oct, 2021 1 commit
  2. 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
  3. 06 Jul, 2021 1 commit
    • Emil Lerch's avatar
      Add AWS Vault support · b0007032
      Emil Lerch authored
      Extension to #496 to add [AWS Vault](https://github.com/99designs/aws-vault)
      support. AWS Vault does not set the AWS_PROFILE/AWS_DEFAULT_PROFILE
      variables, but does add AWS_VAULT. Since this is philosophically the
      same as showing an AWS profile on the prompt, I simply added AWS_VAULT
      to the detection chain.
      b0007032
  4. 14 Jun, 2021 1 commit
    • Ian Smith's avatar
      Add LP_KUBECONTEXT_DELIMITER_PREFIX · 545d297c
      Ian Smith authored
      LP_KUBECONTEXT_DELIMITER_SUFFIX removes a suffix (dev-cluster and - becomes ->
      dev). But sometimes the boilerplate part is a prefix, as when using AWS
      EKS (Elastic Kubernetes Service).
      
      `aws eks update-kubeconfig --name $CLUSTER_NAME` sets the cluster's ARN
      as the context name, most of which is boilerplate:
      `arn:aws:eks:$REGION:$ACCOUNT_ID:cluster/$CLUSTER_NAME`.
      545d297c
  5. 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
  6. 02 May, 2021 1 commit
  7. 13 Apr, 2021 2 commits
  8. 08 Apr, 2021 1 commit
    • Mark Vander Stel's avatar
      Add raw string passing to fix title issues · a23af792
      Mark Vander Stel authored
      The problem is simple enough: the extra backslashes or percents that
      __lp_escape() adds show up in the title, as the title is changed in the
      previous commit to no longer be printed as part of PS1. The fix is not
      so simple.
      
      This patch adds "raw" copy of the data strings for username, hostname,
      and current path with no color or shell character escaping. This is
      designed for putting into the terminal title, but it could also be used
      for comparisons. lp_path_format() already had a no formatting return var
      in lp_path, but now it is not shell escaped.
      
      The title is changed from duplicating the prompt to instead showing just
      the core bits in the central brackets: username, hostname, current path,
      followed by the prompt mark. As well as the user prefix, postfix, and
      MARK_PREFIX. This is a change from the long standing default, but it is
      customizable both by themes and users, and I have long seen complaints
      of the current title layout being less than helpful.
      
      There is one small issue though: to prevent LP_PS1_PREFIX,
      LP_PS1_POSTFIX, and LP_MARK_PREFIX that have color from messing up the
      title, the whole title string is still passed into lp_formatted_title()
      to strip color out. This is less than ideal, but faster than treating
      those 3 variables by themselves.
      a23af792
  9. 05 Mar, 2021 3 commits
    • Mark Vander Stel's avatar
      Replace hostname shell prompt escape with env vars · 03685237
      Mark Vander Stel authored
      Again further work on #651. This time it is simple: both Bash and Zsh
      set the exact same hostname that they use for their prompt escape
      sequences into HOSTNAME and HOST, respectively.
      
      Then it is a simple matter to replicate their "short" version by
      truncating the string to the first period.
      03685237
    • Mark Vander Stel's avatar
      Remove username shell prompt escape code · 61df03a0
      Mark Vander Stel authored
      Another replacement for #651, this one was mostly simple. Unfortunately,
      not all shells set an environment variable for user. Zsh always sets
      USERNAME, but neither Bash nor Zsh set USER. login(1) does however, so
      it _should_ always be set. See https://unix.stackexchange.com/a/76356/421569
      for some good info.
      
      Fall back to id -nu just in case the variables don't work. I don't know
      how portable that command is, but since it is a backup, it should be
      fine.
      61df03a0
    • Mark Vander Stel's avatar
      Add date call to remove shell escape and formatting · dd1f8f87
      Mark Vander Stel authored
      By calling date(1), another shell prompt escape sequence is removed.
      This also allows for custom formatting strings.
      Add and update docs for time functions.
      
      Resolves #281
      dd1f8f87
  10. 26 Feb, 2021 1 commit
    • Sam Pearson's avatar
      Add support for AWS_PROFILE environment variable · 0e552ba7
      Sam Pearson authored
      This will add `[profile_name]` to the prompt should it find either
      `AWS_PROFILE` or `AWS_DEFAULT_PROFILE` set in the environment.
      
      This is useful when switching between different AWS profiles and
      working with multiple accounts.
      0e552ba7
  11. 23 Feb, 2021 1 commit
    • Martin Schütte's avatar
      Add current Kubernetes context data source feature · 0660342d
      Martin Schütte authored
      Add a data source to get the current Kubernetes context. Includes a
      mechanism for truncating the context to the first matching character,
      configurable.
      
      The data source is disabled by default. The truncation is also disabled
      by default (disabled by setting the config option to the empty string).
      
      Add a default theme function to format the context like the other
      development environments.
      0660342d
  12. 26 Jan, 2021 2 commits
    • Mark Vander Stel's avatar
      Fix docs claiming load averages were the 5 minute variant · 1cdd2697
      Mark Vander Stel authored
      While most OSs do have a 5 minute data point of load average, most have
      1 minute as the shortest, which is what Liquidprompt uses.
      1cdd2697
    • Mark Vander Stel's avatar
      Make load display actual load instead of adjusted · e058b619
      Mark Vander Stel authored
      The load average display has been notoriously not helpful. It is scaled
      by the CPU count, and then multiplied by 100 to make it apear like a
      percentage. But load average and CPU utilization have almost nothing to
      do with each other.
      
      This change displays the actual load average, while keeping the
      threshold and color calculations the same. This means the functionality
      is no different, just that the display has changed formats.
      
      To make the configuration options LP_LOAD_THRESHOLD less confusing, it
      too has been changed to be an actual load value, no longer "centiload".
      Old values are still supported, which is done by checking for a period
      ('.') in the string. So for this historical reason, all new values must
      have a period in them. Which should not be a problem, any useful value
      would be a float.
      
      Change the greater-than comparison to a greater-than-or-equal-to, since
      it is a little more intuitive to what would be expected from the config
      option.
      
      Since I was at it, I added a new config option LP_LOAD_CAP, to configure
      the range for color values output by _lp_color_map() for load averages.
      It too takes a load average float value. As it does not have the
      historical reason above, it does not accept "centiload" values.
      
      The implementation details are long. Floating point math does not exist
      in shells (which I suspect is the reason that "centiload" was used in
      the first place). To make it possible to compare, the values are scaled
      up by 100 just like before. They are not shown to the user. 100 scaling
      should be plenty for the precision we need.
      
      To do the scaling, __lp_floating_scale() is added, which as a standalone
      function, can be unit tested.
      
      And for good measure, the lp_load return value is passed through
      __lp_escape(), just in case.
      
      Special thanks to Tore Anderson (@toreanderson) for helping dig through
      the issues here.
      e058b619
  13. 21 Jan, 2021 1 commit
  14. 22 Dec, 2020 1 commit
    • Mark Vander Stel's avatar
      Add _lp_terminal_device() data source · 5076dbe6
      Mark Vander Stel authored
      This data source already existed, but only as part of the default theme
      activation. I doubt that many other themes would want to include it, as
      it was not even part of the default theme by default. It was only a
      optional template section that I doubt many used.
      
      But by breaking it into a function, we can unit test it with test cases.
      5076dbe6
  15. 11 Dec, 2020 1 commit
    • Mark Vander Stel's avatar
      Fix typos in documentation · 3c0846ab
      Mark Vander Stel authored
      A few of these typos are really abbreviations that shouldn't have been
      abbreviated. But most of them are stupid mistakes.
      3c0846ab
  16. 10 Dec, 2020 2 commits
  17. 07 Dec, 2020 1 commit
    • Mark Vander Stel's avatar
      Add Sphinx docs · 0d420d2f
      Mark Vander Stel authored
      Add full documentation of Liquidprompt as Sphinx documentation written
      in reStructuredText.
      Add a ReadTheDocs config file, as that is where this documentation will
      be hosted.
      
      This documentation took a long time to write. And I'm sure it's not
      completely done yet, but I need to get something in the history.
      I am mostly confident that the current state of Liquidprompt is well
      documented now.
      0d420d2f