Bash is run either in interactive mode (e.g. in a terminal) or
non-interactive mode (e.g. on an SSH server handling an SCP request). In
the latter example, any output performed by bash-it's actions will be
interpreted as SCP reply on the client side, typically leading to failed
transfers. This is a well-known limitation of the SCP:
https://bugzilla.redhat.com/show_bug.cgi?id=20527.
In bash's own bashrc example, the first lines of code query for the mode
and return early if it's non-interactive:
http://git.savannah.gnu.org/cgit/bash.git/tree/examples/startup-files/bashrc?h=bash-5.0#n1.
This practice is adopted by Linux distributions (e.g. Ubuntu) and
probably other systems.
Current mode can be queried as described here:
https://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html.
Copy the according lines from Debian stretch's default .bashrc (as found
in https://packages.debian.org/stretch/bash under /etc/skel/.bashrc) to
the bash-it profile template to disable bash-it for non-interactive
shells.
As a side effect, this change makes SCP faster since the server doesn't
need to run any bash-it code in context of SCP handling.
Editorconfig provides the concept of cascading rules, refer to
https://editorconfig.org/#file-location. For instance, I use a rule
which limits line length in git commit messages which enables `vim` to
re-flow the text by a simple command. Setting `root=true` in LT's own
`.editorconfig` file prevents any such user-defined rules from being
propagated.
Remove `root=true` to enable user-defined rules.
Found if this `${cache}` file doesn't exist, the single line conditional command would return false causing a `exit 1`.
This little change makes the conditional verbose and not cause a false return failing the function.
Silence errors when installing
```
Would you like to enable the ag aliases? [y/N] y
~/.bash_it/lib/helpers.bash: line 488: _bash-it-clean-component-cache: command not found
ag enabled with priority 150.
```
In e5b6869 (part of #1283), a regression was introduced, which caused
`bash-it reload` to return with the working directory set to
`.bash_it` and the original working directory discarded.
The root cause is the function wrapper of `bash-it reload`, which has
always relied on the working directory not to change during execution
of the wrapped code. This assumption no longer holds with the changes
introduced in #1283.
This commit fixes the regression by using `pushd`/`popd` in `bash-it
reload`.
A simple, console-compatible Bash-it theme.
Features:
* Reactive coloring for:
* Privileged and standard users.
* Local and remote hosts.
* Exit status for prompt strings 1 and 2.
* Console-compatible!
* No unicode "tofu" in console sessions.
* Matching alignment for prompt strings 1 and 2.
Preview:
$PS1| $TIME $USER@$HOST:$PWD
$PS1| + function foo() {
$PS2| | bar
$PS2| | baz
$PS2| | }