- 29 Jul, 2021 4 commits
-
-
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.
-
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.
-
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.
-
Mark Vander Stel authored
-
- 06 Jul, 2021 2 commits
-
-
Mark Vander Stel authored
PR/679
-
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.
-
- 28 Jun, 2021 2 commits
-
-
Mark Vander Stel authored
PR/678
-
Otto Kekäläinen authored
Also remove some trailing space. Closes: nojhan/liquidprompt#675
-
- 15 Jun, 2021 1 commit
-
-
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
-
- 14 Jun, 2021 2 commits
-
-
Mark Vander Stel authored
PR/673
-
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`.
-
- 30 May, 2021 2 commits
-
-
Mark Vander Stel authored
PR/671
-
Étienne Deparis authored
This breaks several VCS functions (mercurial, fossil, svn).
-
- 09 May, 2021 1 commit
-
-
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
-
- 02 May, 2021 3 commits
-
-
Mark Vander Stel authored
-
Ken Crowell authored
-
Ken Crowell authored
Fixes https://github.com/nojhan/liquidprompt/issues/600.
-
- 28 Apr, 2021 4 commits
-
-
Mark Vander Stel authored
Partially through the work for 2.1, it seemed like it was time to update the Changelog.
-
Mark Vander Stel authored
Adding the work done in commit 9f878488 to the Powerline full theme.
-
Mark Vander Stel authored
Adding the work done in commit 0e552ba7 to the Powerline full theme.
-
Mark Vander Stel authored
Adding the work done in commit 0660342d to the Powerline full theme.
-
- 27 Apr, 2021 6 commits
-
-
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.
-
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().
-
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).
-
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.
-
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.
-
Mark Vander Stel authored
-
- 20 Apr, 2021 1 commit
-
-
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
-
- 13 Apr, 2021 4 commits
-
-
Mark Vander Stel authored
When the LP_COLORMAP config option contained a first element that was the empty string, lp_activate() would think it was empty, and set LP_COLORMAP back to the default value. This was identified by @milouse in a comment here: https://github.com/nojhan/liquidprompt/pull/628#discussion_r611182040 The issue is not severe, as any value set in the config will always be taken (as it is set last). But a value set in the environment, either manually or in a shell RC file would be overridden (as long as the first element was the empty string). Commit e121179d has a good explaination of why the ${array[@]+"${array[@]}"} form is used. This unfortunately must be used _anywhere_ an array could be empty or have any empty strings as values.
-
Mark Vander Stel authored
-
Étienne Deparis authored
-
Étienne Deparis authored
Fixes: https://github.com/nojhan/liquidprompt/issues/249
-
- 08 Apr, 2021 1 commit
-
-
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.
-
- 07 Apr, 2021 2 commits
-
-
Mark Vander Stel authored
-
Aleksey Tsalolikhin authored
configuation -> configuration
-
- 26 Mar, 2021 1 commit
-
-
Michael Livshin authored
Rationale: * In general, it is not proper for liquidprompt to change shell options that it does not absolutely have to change. * LP_PS1_{PREFIX,POSTFIX} are a thing, and are in fact an effective means to combine liquidprompt with other prompt-touching logics (such as emacs-vterm). So it is not good to prevent those other logics from actually working. This commit restores the bash version of __lp_escape to what it did prior to 62f02708 (escaping dollar signs in addition to backslashes) and removes all interference with the promptvars shell option. NOTE: I don't know much about shells other than bash, so left the parallel logic for zsh as is.
-
- 20 Mar, 2021 2 commits
-
-
Mark Vander Stel authored
-
Dugan Chen authored
-
- 10 Mar, 2021 1 commit
-
-
Mark Vander Stel authored
This feature depends on the removal of the prompt escape sequences that came before. Part of that is the removal of adding the title to $PS1: now it is just print to the screen. This could improve speed slightly, as the shell doesn't need to parse that text. But it does prevent usage of prompt escape codes in the title. Which causes a rare issue where __lp_escape() adds duplicate backslashes or percents to escape a string for the prompt, but now are not needed in the title. It will just print double in the title, so it isn't a huge issue, but is something that should be fixed. I'm not sure how to handle it though, since the current architecture requires escaping the strings before formatting is added to them. I also needed to rework how the runtime feature was handled, since it monopolized the DEBUG trap in Bash. Now it can handle multiple features that need to run after the user has submitted the command, but before it runs. The feature itself is simple: lookup the latest command in the history, and print the normal title postpended by that command to the screen, formatted as a terminal title. Note that Bash's $BASH_COMMAND is not great, as it only contains the current _command_, not the whole command line. Resolves #609
-
- 05 Mar, 2021 1 commit
-
-
Mark Vander Stel authored
This was forgotten before.
-