Allows for setting "COMMAND_DURATION_MIN_SECONDS" to more than 60 seconds without adding to prompt. Previously always showed with lengths over 60 seconds regardless of setting.
* fix (plugins): enable interpretation of backslash escapes in colors
* fix (lint): disable SC2317 in install.sh
* fix (lint): SC2086 in agnoster theme
* fix (lint): remove exit from install.sh as it is already implemented in the calling function
* Use C style strings when checking for invalid alias characters
Before, the '\n' would be interpreted as 'n' meaning that any alias
who's command contained the letter 'n' would incorrect be skipped.
* No need to escape characters in this context
Escaping was just adding \ to the list multiple times
Co-authored-by: David Farrell <davidpfarrell+github@gmail.com>
Git can list local branches, remote branches, and both of them together.
Let's use the long form of the options to make the aliases quicker to understand.
As agreed in PR #2159, we introduce gbl and replace gba/gbr by gbla/gblr.
gbl/gbla/gblr allow wildcard arguments for filtering branch names.
Isolates fetching of EPOCHREALTIME to a function which sets LC_ALL=en_US.UTF-8.
This ensures that the value is in decimal format, regardless of runtime locale.
bug: Hide duration when no command executed
Ensures that the -E or -F option, when used, is the first option
* i.e. grep -oE => grep -E -o
Updates _bash-it-grep to invoke grep with just the provided arguments
* This function was (and still is) unused, but decided this new functionality was actually more useful
Introduces _bash-it-fgrep to invoke grep -F
Removes type -P egrep from the _bash-it-*grep functions
For usages that were already going to be modified, use -F if appropriate
* Does not touch grep usages that may have benefited from -F, but were not otherwise considered for this PR
Adds shellcheck header to modified .bash files that didn't already have it
This regression was introduced in ea2002a.
Before this commit, when the provided project was unique under all the
project paths, the command automatically change the directory to it.
Currently this is no more the case.
If there are many project paths set, then the project path menu is shown
at every call.
This PR solves this issue.
Signed-off-by: Eric Villard <dev@eviweb.fr>
* Add a 'theme' for OMP, so the internal themes don't clash with it.
* Add theme to clean_files
* Add screenshot to the docs
* Correct the name of the default theme in the docs.
* keeping it cleaner
Co-authored-by: Ira Abramov <github@ira.abramov.org>
Use `$EPOCHREALTIME` (or `$SECONDS`) built-in variable provided by Bash instead of `date +%s`. We're only measuing the difference in seconds, so avoid both the binary invocation as well as the subshell.
Alsö, Reduce environmental pollution by not exporting every variable, and unsetting when done.
Change variable names to match lib/command-duration
Remove `preexec_return_notification()` in favor of `lib/command-duration`'s `_command_duration_pre_exec()`.
This should now use the same preexec hook and variables as the theme library `command_duration`.
tests: handle nanoseconds
Fallback to `$SECONDS` for older versions of _Bash_.
Instead of shortcircuiting the definition, just short-circuit the function. This allows the variable to be set later, e.g. on theme change.
Calculate the position (from 1 to 12) of the hour hand on the clock emoji used for the _command_duration string.
Expressly handle COMMAND_DURATION_COLOR as blank when undefined.
My apologies to future `git blame` hunters ♥
Use the "short" host name by default (`\h`), not the fully qualified domain name (`\H`)...
lib/theme: don't redefine battery_char()
Combine the two definitions for `battery_char()` so the second one doesn't just overwrite the first one. Do one or the other, not both.
Don't evaluate if `battery_percentage()` is available at load time, evaluate it at run time.
Don't run `date` for `$THEME_TIME_FORMAT`, use `\D{fmt}`.
Run the test *files* in parallel, but not the tests *within* the files. This can be reverted after configuration (i.e., `$BASH_IT/enabled` et al) lives *outside* the repo.
- Use a POSIX-compliant/portable extended regular expression to match on word-boundaries, rather than guessing which regex library `bash` was linked against. See https://stackoverflow.com/a/12696899/555333 for explanation and code suggestion.
Rewrite comment on disabling the `DEBUG` trap in subshells, which is now handled upstream as of rcaloras/bash-preexec#26.
Alsö, fix the guard variable assignment to allow it to be overridden elsewhere (e.g., for testing).
When the file is being re-created, we write to it, instead of appending to
it. So, the rm here is unnecessary and prevents users from linking the profile
file to another location that is potentially under version control. For
instance, once could link to a profile file located at
"$BASH_IT_CUSTOM/profiles/*.bash_it".
- Replace `echo -e` with `printf` in `_bash-it-log-message()`.
- Local positional parameters to allow for defaults.
- Use `if`/`then` properly.
- Clean up use of `$BASH_IT_LOG_PREFIX` slightly (eliminate duplicate colons).
Alsö, remove impossible alias. If someone wants it, they can write the function, but since aliases literally don't work this way it seems obvious that nobody has ever used it.
* 'master' of https://github.com/Bash-it/bash-it: (22 commits)
main: variable name cleanup
lib/history: new functions `_bash-it-history-auto-*()`
plugin/history*search: no need to load after `plugin/history`
plugin/history-eternal: Use `readonly` instead of `export`
plugin/history: don't use `export`
lib/preview: add full completion
lib/helpers: add `preview` to `bash-it` spaghetti
lib/preview: refactor into a function
completion/system: correctly load version when not linked
main: adopt `_bash-it-log-prefix-by-path()`
main: Glob for *.bash properly when path contains spaces
completion/aliases: rename init function
test/battery: require matching battery identifier
test/battery: add multiple-battery edge case
plugin/battery: split `upower` to two variables
completion/alias: add stub file
completion/alias: fix tests
completion/alias: rename
completion/alias: `shfmt` && `shellcheck`
completion/alias: eliminate use of `eval`
...
Two new functions `_bash-it-history-auto-save()` and `_bash-it-history-auto-load()`, which append new history to disk and load new history from disk, respectively.
See bash-it/bash-it#1595 for discussion.
...and hide errors relating to setting already-readonly variables.
`plugin/history-eternal` does not need to force loading after `plugin/history` because both plugins will play nicely with read-only variables, and since we're overwritting and marking read-only then the intended result survives no matter which loads first.
plugin/history-eternal: require Bash v4.3+
Unlimited history is only possible in _Bash_ version 4.3 and up
This allows future use like `bash-it preview`. Alsö, allows to use `$BASH_PREVIEW` to specify a particular theme to preview instead of just doing all of them.
- `shfmt`, `shellcheck`
- Clean up legacy/compatibility code to simpler control flow
- Move theme stuff down to where themes are handled
- Don't use `**` as _Bash It_ has never before set `globstar`; this eliminates varying behavior by environment; this alsö fixes users having any not-enabled themes under their custom dir.
- Lose weird Mac-specific alternate shell startup file (Bash loads startup files on Mac the same as it does on any other *nix system.)
- Place `composure.sh` init all in one place
- remove 10-years-deprecated backwards compatibility: Deprecated in `b59ee658f78ec6ff8c6c2754216e0322b7fe18e2` dated 2011-10-29.
There is no reason for this to be in the `plugins` directory, it just needs to have a load priority sufficiently high that it runs after any aliases are defined.
Improve `_bash-it-erase-term()`, `_bash-it-flash-term()`, `_bash-it-rewind()`, `_bash-it-search-result()`, and `_bash-it-search-component()`. Minor tweaks to `_bash-it-is-partial-match()`, and `_bash-it-search()`.
1. `$text_black` isn't a parameter provided by _Bash It_. Typo?
2. `$bold_yellow` is meant for prompt strings and putputs `\[`; ditto `$bold_red`.
3. The color was never returned to normal after.
This reverts commit 2a3fde2b14 but does *not* restore the previous variables. Those are still provided by `lib/colors`.
This plugin exists for anyone who likes the metaprogramming adventure of computing colors dynamically rather than using hard-coded value. Potentially this could be used by themes, or possibly by a theme color-scheme randomizer?
This reverts bash-it/bash-it#99, a metaprogramming adventure in terminal color code escape computation. It was functionally reverted in bash-it/bash-it#699; I'm just finishing the job.
When `upower --enumerate | grep -i BAT` returns multiple lines of results (which are file paths),
the added quotation (from commit 3cb5f3f7e6) concatenates them all to provide an invalid path.
Thus to make the plugin work as before the commit,
take only the first line of the results.
Bash loads initialization files on Mac just the same as it does on Linux or WSL. Our previous assumptions were wrong, and my fix was alsö wrong because I made more assumptions!
This patch eliminates the assumptions. Literally just load either the startup file the shell started with, or fall back to `~/.bashrc`. Don't check `shopt -q login_shell` and don't check `$OSTYPE` or anything else.
Define the helper functions for `bash-preexec.sh` immediately after importing it, rather than in `lib/theme`.
- `__check_precmd_conflict()` and `save_append_prompt_command()` are generally useful and not theme-specific.
- Add matching `__check_preexec_conflict()` and `safe_append_preexec()`.
...to `_bash-it()`.
The norm is for the completion function for, e.g., `teh_cmd`. to be named with the same name and a prepended underscore, i.e. `_teh_cmd`. This alsö reduces namespace confusion, which will be relevant in a future patch.
when i tried to install, i got a message `_bash-it-pluralize-component` command not found; after checking `utilities.bash` the correct function name was `_bash-it-component-pluralize`
Quote some parameter uses that don't strictly require it, but since Bash needs so many quotes everywhere else my brain worms feel better when these are quoted too.
lib/helpers: simplify some quote escapes
Replace weird non-globs with array and loop, as suggested by `shellcheck`. Alsö, simplify several constructs to eliminate external binaries.
Alsö, see mvdan/sh issue 558
lib/helpers: unbound positional parameters
- Improve `pushd`/`popd` somewhat
- local some parameters
- Lose weird Mac-specific alternate shell startup file (Bash loads startup files on Mac the same as it does on any other *nix system.)
Quote things, SC2268, SC2143, SC2181, SC2162, SC2016, SC2013, &c.
Rewrite globbing per `shellcheck`’s SC2013, and alsö s/typeset/local/g. Eliminate `compgen` where possible.
Alsö: use the existing utility functions `_bash-it-get-component-type-from-path` and `_bash-it-get-component-name-from-path`, which just use parameter substitution anyway. Why was `sed` here?
Alsö, don't add not-existing directories to `$PATH` in `pathmunge()`.
Finally, merge PR #1865 from NoahGorny...and clean it a bit...
- Don't write to disk, just pipe.
- Don't loop, just do all functions.
Performance of old implementation on my system:
```
real 0m9.996s
user 0m5.318s
sys 0m9.126s
```
Performance of new implementation on my system:
```
real 0m0.052s
user 0m0.069s
sys 0m0.025s
```
Don't use `local -n var` so that we can support v3.2...
Note: function names and variable names are different namespaces, so we can have a variable named the same as the function...which makes it really easy to predict default names for results when returning this way.
...to replace `_set-prefix-based-on-path()` in `scripts/reloader`.
Deliberately does not use `_bash-it-get-component-name-from-path()`/`_bash-it-get-component-type-from-path()` as we need some of the intermediate state and would have to reimplement anyway.
Alsö, fix tests to load `lib/colors` instead of `lib/appearance`...wut
Alsö, `short-circuit _has_colors()`: If we already looked up colors, and we already have them, then don't run `tput` again.
My apologies to future `git blame` hunters ♥
Create an array `_bash_it_library_finalize_hook` and loop at the end of the main `bash_it.sh` to run each element in the array.
The purpose here is to run some command after everything else has been loaded. For example, the appearance lib checks for executables for SCM commands, but `$PATH` may be altered after appearance has loaded and therefore some available commands may never be discovered. Therefore, create `_bash_it_appearance_scm_init()` and add it to the hook. It will re-check at end of `bash_it.sh` just before prompt is first displayed.
Load the completion script from the subversion package installed on the system, instead of bundling a copy. This addresses Bash-it/bash-it#1818.
NOTE: If `completions/system` is enabled, then it will load this same file anyway automatically.
Symlink `/test_lib/bats-core/test/fixtures/parallel/suite/helper.bash` references a not-existing file, but it's in a submodule so I can't just fix it. Exclude it from `rsync` in `setup_test_fixture()`.
Test was failing only on Mac OS X for some reason, so refactor a little. It turned out to be due to explicitly setting `$HOME` *after* loading the plugin.
Literally copying a line from the source to be tested is perhaps not the best way to test that code. 😉
That said, we do want to verify that the function was actually loaded.
TODO: actually test the function.
For testing non-core files, just `load ../test_helper_libs` after `load ../test_helper` instead of trying to guess which libs must be loaded, in which order, for testing to succeed.
`_command_exists` spews log messages, so our test log is littered with `_log_debug not found`. This fixes that too.
Lose a couple of useless `echo`s/subshells.
Alsö, lose the incorrect VIM modeline from the bottom. Our formatting standard is specified in `$BASH_IT/.EditorConfig`.
Use shell functionality to avoid invoking external binaries, and quote some stuff. Alsö, use $EDITOR and related variables in order to fall through if some aren't defined.
Move the test for whether `plugin/todo` is enabled inside the function, and remove the alias from there.
Alsö, respect `$XDG_STATE_HOME` and move the old `~/.t` file if it exists.
plugins/osx: dead code removal
No need for gymnastics to determine if variable had been exported priort to modification. If it was, then it still is. See man bash(1).
This reverts commit 2c8ee40566.
- _Shellcheck_ documentation for the [`source-path`]( https://github.com/koalaman/shellcheck/wiki/Directive#source-path ) directive indicates this is correct usage. We're `source`ing the `bash-preexec.sh` file from inside the `vendor/github.com/rcaloras/bash-preexec` directory. If we used the [`source`]( https://github.com/koalaman/shellcheck/wiki/Directive#source ) directive, then the full complete path to the file itself would need to be specified.
- Fix `disable=1090` to `disable=SC1090` and remove duplicate lines since this `shellcheck` directive will apply to the entire if-ladder.
- Disabling `SC2154` is almost never appropriate. In this case, several `_git_bash_completion*` variables are expressly assigned in this file, so there is no "unknown" to ignore.
Aside: the `${!_git_bash_completion@}` construct will expand to all variables starting with the previx `_git_bash_completion`, so this line is just a shorthand way to clear all our variables concisely without forgetting any.
- remove the use of redundant cite
- minor cleanups to history.plugin.bash
- set explicit load orders for history-search and history-substring-search
- add new plugin history-eternal
- replace superfluous trap for managing HISTTIMEFORMAT changes
I have a repo with many other branches that contain the string `main`,
but our default branch is still master. This grep was seeing those other branches
and deciding that my default branch was `main`. This tighter regex
fixes that behavior for me.
By setting `__bp_delay_install`, we avoid any immediate initialization at all. We then override two troublesome functions before calling `__bp_install_after_session_init()`.
The `__bp_install_after_session_init()` function doesn't enable the DEBUG trap, just sets `$PROMPT_COMMAND` to include `__bp_install()`, so the actual final `$PROMPT_COMMAND` is not finished, and DEBUG trap set, until after the first prompt is displayed.
The existing function `_bash-it-grep()` is weird. New function `_bash-it-egrep()` just does the thing without requiring two subshells and manual invocation.
Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.
This resolvesBash-It/Bash-It#1904.
No need to `rm` when we overwrite the file the line after next. Alsö, use `>|` in case the user sets `noclobber`; we do expressly intend to overwrite the file in this case.
The tilde should not have been escaped, and in fact I did not have it escaped in my main branch, but the PR I submitted did have it escaped and...now it shows up in the prompt line for all the PowerLine themes... oops.
This commit cleans up the pyenv plugin to follow the newer conventions of the
other *env plugins, as well as addresses the changes made to pyenv for PATH
munging.
* lib/utilities: shellcheck
SC2059
* lib/utilities: fix `_bash-it-get-component-type-from-path()`
Account for plugins with names that contain periods.
* lib/utilities: fix `_bash-it-array-dedup()`
Use fewer subprocesses and newline-delimited not space-delimited.
* lib/utilities: fix `_bash-it-component-list()`
Use fewer subprocesses and return newline-delimited, not space-delimited.
* lib/utilities: fix `_bash-it-component-list-matching()`
Use `sort -u` instead of `sort | uniq`
* lib/utilities: fix `_bash-it-component-list-enabled()`
Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort`
* lib/utilities: fix `_bash-it-component-list-disabled()`
Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort`
* lib/utilities: fix `_bash-it-grep()`
1. Executing `'/usr/bin/grep'` does *not* return the path to grep...
2. use `type -p` instead of external binary `which`.
3. Simplify parameter definition.
4. Why was there a space after `%s`?
* lib/utilities: use `_bash-it-grep`
Alsö, lose a spurious `cat`
* lib/utilities: lint `_bash-it-component-help`
* lib/utilities: lint `_bash-it-component-cache-file()`
* lib/utilities: `shfmt`
My apologies to future `git blame` hunters ♥
* lib/helpers: fix `_bash-it-get-component-name-from-path()`
Use `${BASH_IT_LOAD_PRIORITY_SEPARATOR}`
* plugins/base: code style improvements
Quote variables, use $@ and $array[@] instead of $*, typeset some integers, remove unneccesasary binary invocation, use shell features when possible, remove `eval`, &c.
* plugins/base: conditional function definitions
Instead of functions failing when required tools aren't installed, just don't define the function.
Alsö, don't redefine del() if it already exists.
* plugins/base: rewrite `usage()`
Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary.
* plugins/base: revamp `quiet()`
New implementation that is even quieter.
* plugins/base: `myip()`
* plugins/base: `pickfrom()`
* plugins/base: `passgen()`
Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`.
* plugins/base: `mkcd()`
* plugins/base: `mkiso()`
* plugins/base: remove `banish-cookies()`
Adobe Flash is gone with the wind. Alsö, this would be something someone would do *once* and shouldn't be a function...
* plugins/base: `lsgrep` is SC2010
The `lsgrep()` function is *itself* explicitly forbidden by `shellcheck` rule SC2010.
Alsö, s/`$*`/`$@`
* plugins/base: `mkiso()`
Expressly handle unbound parameters.
* plugins/base: remove `command_exists`
* plugin/base: lint SC2154 && SC2144
Newly undisabled `shellcheck` rules
* plugin/base: import libs for tests
* plugin/base: `shfmt`
Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
- Remove limitation on OS.
- Add search for Mac OS X developer tools locations by using `xcrun` instead of trying to guess paths.
- Add search for locations based on path of `$GIT_EXE` (set by `lib/theme`).
Addresses bash-it/bash-it#1632
And use `_log_warning`.
Alsö, code style cleanup: quote things, handle unbound parameters, &c.
Alsö alsö, short-circuit if not installed or inadequate _Bash_ version.
Short-circuit the loader rather than indenting nearly the whole file.
ALSÖ, assign the `_pip_completion()` handler directly once it's loaded so that we get out of the way once we load it.
Convert from indented if-block to return then unindented code. This should have basically one line change at the top, one line removed at the bottom, and then all whitespace.
Convert from indented if-block to return then unindented code. This should have basically one line change at the top, one line removed at the bottom, and then all whitespace.
New function to do a search looking for a sibling to a parent of the current directory, for example to find `../../.git` to indicate that `$PWD` is inside a git repository.
* CI: disable Ubuntu 16.04 as it's EOL
https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/
* main: lint false positive
* install: lint
* plugins/cmd-returned-notify: don't `export`
* plugins/xterm: lint
* plugins/git: lint
* plugins/goenv: lint
* plugins/alias-completion: lint false positives
* plugins/alias-completion: fix SC2155, SC2154
Declare `locals` at the top of the function
* completion: lint completions using `bash_completion` functions
Match the style of the existing code
* completion/knife: lint false positives
* completion/knife: lint
* completion/sdkman: lint
* completion/composer: lint
* Move `.shellcheckrc` under `themes/`
* lib/theme: fix SC2155, SC2154, SC2034
* lib/colors: don't warn on unused variables
We assign a large number of variables here and they may or may not be used anywhere else, so disable SC2034 for this file (only).
Alsö disable SC2005 as the functions in this file were written before `printf` was invented and have to do some fancy metascripting to get escape sequences interpreted reliably. I’m not smart enough to fix this to use `printf`, so leave it for now.
* themes/agnoster: lint
* themes: disable SC2154 for colors
Each one of these themes will need it’s own fix for SC2154, possibly upstream.
Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.
* themes: disable SC2154, fix SC2155
Each one of these themes will need it’s own fix for SC2154, possibly upstream.
Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.
* Delete `.shellcheckrc`
* remove executable bit
Despite `indent_size` being set to `tab` by default, it turns out that we set `indent_size` to `2` for `*` at the top of this file. So, for everywhere else, explicitly set `indent_size` to the default (`tab`). This should achieve the goal of my last patch to `.editorconfig`.
Convert `var=${dirname $filename)` to `var="${filename%/*}` in cases where there is no ambiguity.
Make sure that the path in `$BASH_IT` is absolute because this path gets embedded in the template `.bash_profile` file if selected by the user.
Wrap init code in a function and call the function immediately. Several plugins do this, and it allows us to more easily implement a hooks-based system in the future.
Alsö, avoid external binary `which`. Use built-in `type -P` instead. Uppercase `-P` forces a path search to avoid hashed matches and functions/aliases and whatnot.
Give up and accept defeat that bash-completion can't reasonably be audited for unbound parameters. Wrap invocation with disabling strictness, and restore after if it was enabled.
If the user hasn't defined BASH_IT_LOG_LEVEL, then the integer comparison fails. Handle it by defaulting to '1'.
If lib/log is loaded improperly, the BASH_IT_LOG_PREFIX may be undefined. Unlikely, but no harm in handling it too.
Likewise, if no theme is loaded, then $echo_green, $echo_normal, et al are not defined.
Check if `brew` is installed every time, and *unset* `$BASH_IT_HOMEBREW_PREFIX` if not found. This accounts for the edge-case of a user _uninstalling_ Homebrew without restarting the shell.
Use new function `_bash_it_homebrew_check()` in existing plugins and completions which look for Homebrew.
Alsö, use `$OSTYPE` instead of calling external `uname` binary.
New function `_bash_it_homebrew_check()` sets global variable `$BASH_IT_HOMEBREW_PREFIX` using `brew --prefix` if `brew` exists as a valid command. If `brew` isn't installed, then return failure.
Plugins can test for `brew` by calling this function and, if it succeeds, they can rely on `$BASH_IT_HOMEBREW_PREFIX` being defined properly.
Renamed the function to _bash-it_update_migrate_and_restart
Use pushd/popd instead of passing another parameter
Document the function so it will be clear that it does not return
When using tabs, `indent_size` should be set to `tab`, which is the default. Furthermore, `tab_width` (which is likely what was intended when `indent_size` was entered) should be left up to the user. If the user likes an 8-character indent, then let them. If they like 2-character indent size, then let them. Using tabs means that this all works normally for everyone, even if it's different on different screens.
* lib/helpers: use `$OSTYPE` instead of `$(uname)`
* plugins/osx: use `$OSTYPE` instead of `$(uname)`
* plugins/boot2docker: use `$OSTYPE` instead of `$(uname)`
* plugins/python: use `$OSTYPE` instead of `$(uname)`
* plugins/base: use `$OSTYPE` instead of `$(uname)`
Alsö, use `[[` instead of `[` as the former has less insane argument handling being shell syntax rather than a builtin command that must emulate being a real binary
* completion/brew: use `$OSTYPE` instead of `$(uname)`
* completion/git: use `$OSTYPE` instead of `$(uname)`
Alsö, use `[[` instead of `[`.
* completion/fabric: use `$OSTYPE` instead of `uname`
* theme/demula: use `$OSTYPE` instead of `$(uname)`
* theme/rana: use `$OSTYPE` instead of `$(uname)`
Need to use grep WITHOUT case-sensitivity. Otherwise results such as com.apple.iChat and com.apple.imagent won't be handled correctly and neither one can be completed.
Fixed another comparison that prevented "defaults read com.apple.iChat <complete>" from correctly returning the available defaults keys in that file.
Bash-completion supports pre-defining $BASH_COMPLETION as the path to the main script, so use that if it's defined.
Alsö, don't load homebrew's completion if we've successfully loaded one already.
Instead of using the profile.d version, just invoke the script. The profile.d script preemptively short-circuits if it thinks that bash-completions has already been loaded, which it does by using the $BASH_COMPLETION variable, which is expressly supported by upstream to specify the location of the script...so it will entirely be never loaded if this is set.
available_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash"| sort -d`;
do
file_entity=$(basename $f)
typesetenabled_component=$(command ls "${BASH_IT}/$subdirectory/enabled/"{[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity,$file_entity} 2>/dev/null | head -1)
typesetenabled_component_global=$(command ls "${BASH_IT}/enabled/"[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity 2>/dev/null | head -1)
[](https://web.libera.chat/?channel=#bash-it)
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
Have you ever wanted to port your *Bash-it* configuration into another machine?
If you did, then ``bash-it profile`` is for you!
This command can save and load custom *"profile"* files, that can be later
used to load and recreate your configuration, in any machine you would like |:smile:|
When porting your configuration into a new machine, you just need to save your current profile, copy the resulting *"profile"* file, and load it in the other machine.
Example
^^^^^^^
..code-block:: bash
# Saves your current profile
bash-it profile save my_profile
# Load the default profile, which is the one used in the default installation.
bash-it profile load default
# Do whatever you want:
# Disable stuff
bash-it disable ...
# Enable stuff
bash-it enable ...
# If you want to get back into your original configuration, you can do it easily
Plugins can define a function that will be called when the plugin is being disabled.
Plugins can define a function that will be called when the plugin is being disabled.
The callback name should be ``{PLUGIN_NAME}_on_disable``\ , you can see ``gitstatus`` for usage example.
The callback name should be ``{PLUGIN_NAME}_on_disable``\ , you can see ``gitstatus`` for usage example.
Library Finalization Callback
-----------------------------
Specifically for Bash-it library code, e.g. in the `lib` subdirectory, a hook is available to run some code at the very end of the main loader script after all other code has been loaded. For example, `lib/theme` uses `_bash_it_library_finalize_hook+=('_bash_it_appearance_scm_init')` to add a function to be called after all plugins have been loaded.