527 Commits

Author SHA1 Message Date
Ira Abramov
be9a838015 Fix knife completion (#2098)
Co-authored-by: Ira Abramov <github@ira.abramov.org>
2022-03-01 23:22:56 +02:00
Noah Gorny
34bc37c178 Merge pull request #2061 from gaelicWizard/lib/helpers
lib/helpers: fixes, improvements, consolations, constellations, and a partridge in a pear tree
2022-03-01 23:21:27 +02:00
John D Pell
789ede9ef3 plugin/battery: fix tests 2022-02-24 12:52:26 -08:00
John D Pell
604f9b0baa Remove executable bit. 2022-02-24 12:47:22 -08:00
John D Pell
47bbc73744 lib/helpers: _bash-it-find-in-ancestor()
Use new `composure.sh` feature to avoid `cite()`.
2022-02-24 12:47:22 -08:00
John D Pell
5957d189ea lib/utilities: _bash-it-component-item-is-enabled()
- Use normal `if`/`then`
2022-02-20 12:01:05 -08:00
John D Pell
fe48deda2d lib: rename _bash-it-clean-component-cache()
…to `_bash-it-component-cache-clean()`
2022-02-20 12:01:05 -08:00
John D Pell
6257853759 lib/utilities: use $XDG_CACHE_HOME properly
We should fall back to the default location, not use an entirely different one.
2022-02-20 12:01:05 -08:00
John D Pell
72829ca21d lib/utilities: _bash-it-component-item-is-enabled()
- required arguments
2022-02-20 12:01:05 -08:00
John D Pell
ffcf8f1c94 lib/utilities: >| 2022-02-20 12:01:05 -08:00
John D Pell
fbd842b2ea lib/helpers: fix extraneous quotes from _bash-it-grep() 2022-02-20 12:01:05 -08:00
Noah Gorny
33bade22b7 Merge pull request #2073 from gaelicWizard/lib/preexec
Update "preexec" from "https://github.com/rcaloras/bash-preexec@master"
2022-02-19 23:56:56 +02:00
Noah Gorny
1c8ad2c1b7 Merge pull request #2096 from akinomyoga/plugin-blesh-workaround-reloader-change
bash_it.sh: source `reloader.bash` without arguments for the default enabling
2022-02-19 23:43:20 +02:00
Koichi Murase
ee853670a1 bash_it: suppress a false error by shellcheck 2022-02-19 17:17:45 +09:00
Koichi Murase
41cf3cfaf2 plugin/blesh: override possible arguments inherited by callers 2022-02-19 16:34:22 +09:00
Koichi Murase
e05fa477d7 bash_it: source reloader.bash without arguments for the default enabling 2022-02-19 16:34:22 +09:00
John D Pell
150f73ee50 bash-it update: show change log once 2022-02-18 03:06:17 -08:00
John D Pell
2cea663a4a lib/theme: handle undefined parameter 2022-02-18 03:06:17 -08:00
John D Pell
95353f1a98 lib/helpers: the last remnants of the $OSTYPE have been swept away
- Figure out which `sed` we have by checking, not guessing.
2022-02-17 20:46:28 -08:00
John D Pell
ddf75f17ac lib/search: fix variable scope 2022-02-17 20:46:28 -08:00
John D Pell
35ecc260c2 lib/helpers: handle unbound parameters 2022-02-17 20:46:28 -08:00
John D Pell
31751624c0 lib/helpers: cleanup _bash-it-profile-load-parse-profile() a bit 2022-02-17 20:45:37 -08:00
John D Pell
e7818dbaca lib/helpers: handle unbound positional parameters
Alsö, don't `pushd`/`popd` when restarting shell.
2022-02-17 20:45:37 -08:00
John D Pell
60c10004d1 lib/helpers: fix _bash-it-component-pluralize() 2022-02-17 20:45:27 -08:00
John D Pell
8246794a28 lib/preexec: the last remnants of the $OSTYPE have been swept away
- 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.
2022-02-16 16:10:41 -08:00
John D Pell
c1943192ce lib/preexec: clarify subshell guard and comment
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).
2022-02-16 16:10:41 -08:00
John D Pell
a93919625d lib/preexec: adobt _bash_it_library_finalize_hook
Schedule modification of `$PROMPT_COMMAND` for after everything has loaded.
2022-02-16 16:10:41 -08:00
John D Pell
6b08284928 Update "preexec" from "https://github.com/rcaloras/bash-preexec@master"
git-vendor-name: preexec
git-vendor-dir: vendor/github.com/rcaloras/bash-preexec
git-vendor-repository: https://github.com/rcaloras/bash-preexec
git-vendor-ref: fd2ffa8876d3940c97ffdc3cc807e43277cf72da
2022-02-16 16:10:41 -08:00
Noah Gorny
187916d903 Merge pull request #2047 from gaelicWizard/alias/shfmt
Aliases: lint the entire folder
2022-02-16 22:47:36 +02:00
Noah Gorny
caae145f5a Merge pull request #2068 from gaelicWizard/theme/pure
theme/pure: cleanup
2022-02-16 22:46:59 +02:00
Noah Gorny
379813b671 Merge pull request #2086 from seefood/ira/fix-dirs
Tilde expanstion won't work once it is a quoted string, expanding in advance
2022-02-16 22:45:02 +02:00
Noah Gorny
9d6fe72267 Merge pull request #2088 from gaelicWizard/lib/log
lib/log: //echo/printf
2022-02-16 22:18:22 +02:00
Noah Gorny
0b1c65b100 Merge pull request #2092 from punchagan/link-profile
lib/helpers: Don't rm "$profile_path" before writing to it
2022-02-16 22:14:28 +02:00
Noah Gorny
b550b99160 Merge pull request #2091 from gaelicWizard/completion/alias
completion/aliases: redirection, quote, temp file
2022-02-16 22:12:57 +02:00
Puneeth Chaganti
b3ef9ea209 lib/helpers: Don't rm "$profile_path" before writing to it
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".
2022-02-16 20:55:08 +05:30
John D Pell
e7b91e7be5 lib/log: use newly supported composure.sh feature
- these functions can now run even if `composure.sh` has *not* been loaded at all!
2022-02-15 22:20:19 -08:00
John D Pell
61b6393a4a lib/log: //echo/printf
- 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).
2022-02-15 22:18:24 -08:00
John D Pell
4ba11dbaa2 completion/aliases: redirection, quote
Alsö, some aliases are returned by `alias -p` with `alias -- xxxxx`...which confuses the function, so handle it specially.
2022-02-15 22:09:27 -08:00
Noah Gorny
562eb6ce68 Merge pull request #2083 from tbhaxor/patch-1
Remove redundant aliases for clear screen
2022-02-15 22:47:42 +02:00
Noah Gorny
78da4ca760 Merge pull request #2089 from gaelicWizard/plugin/alias-completion
completion/aliases: typo
2022-02-15 22:09:44 +02:00
John D Pell
c982a881a2 completion/aliases: typo 2022-02-14 16:00:15 -08:00
John D Pell
12a734cb49 aliases/general: use single quotes as much as possible 2022-02-14 15:40:56 -08:00
John D Pell
27bfc966ac aliases: add shellcheck headers 2022-02-14 15:40:56 -08:00
John D Pell
604e5c5040 alias/todo.txt-cli: shellcheck 2022-02-14 15:40:56 -08:00
John D Pell
665d9e96a8 alias/osx: shellcheck 2022-02-14 15:40:56 -08:00
John D Pell
8d30275b8a alias/msys2: shellcheck 2022-02-14 15:40:56 -08:00
John D Pell
ea6cb6afec alias/laravel: shellcheck 2022-02-14 15:40:56 -08:00
John D Pell
826916be4f alias/homesick: shellcheck
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.
2022-02-14 15:40:56 -08:00
John D Pell
11aa32387e alias/general: shellcheck 2022-02-14 15:40:56 -08:00
John D Pell
5748aa20a7 alias/docker: shellcheck 2022-02-14 15:40:56 -08:00
John D Pell
7c2c2a5525 aliases: run shfmt on the whole folder
My apologies to future `git blame` hunters ♥
2022-02-14 15:40:56 -08:00
Ira Abramov
16bf32be65 Merge branch 'master' of https://github.com/Bash-it/bash-it into ira/fix-dirs
* '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`
  ...
2022-02-14 10:31:04 +02:00
Noah Gorny
0619c19f65 Merge pull request #2074 from NariyasuHeseri/master
plugin/battery: bug fix
2022-02-14 08:22:33 +02:00
John D Pell
363827a3b5 theme/pure: cleanup
Use `\$` to let _Bash_ choose the mark, move `PS1=` outside the `case` statement.

#TODO: last command status?
2022-02-13 16:18:00 -08:00
Noah Gorny
561e282585 Merge pull request #2044 from gaelicWizard/completion/alias
completion/aliases: eliminate use of `eval`
2022-02-13 23:59:35 +02:00
Noah Gorny
89c9504a5e Merge pull request #2017 from gaelicWizard/lib/preview
lib/preview: functionalize
2022-02-13 23:59:06 +02:00
Noah Gorny
ee135d28da Merge pull request #2069 from gaelicWizard/completion/system
completion/system: correctly load version when not linked
2022-02-13 23:57:35 +02:00
Noah Gorny
253004a599 Merge pull request #1940 from gaelicWizard/history
Feature: automatic history management
2022-02-13 23:57:14 +02:00
Noah Gorny
23f9b7416a Merge pull request #1902 from gaelicWizard/glob
Glob for *.bash properly when path contains spaces
2022-02-13 23:53:57 +02:00
Ira Abramov
98889b208c Tilde expanstion won't work once it is a quoted string, expanding in advance. 2022-02-11 09:56:10 +02:00
John D Pell
146107926e main: variable name cleanup 2022-02-10 10:46:33 -08:00
John D Pell
5d5858058e lib/history: new functions _bash-it-history-auto-*()
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.
2022-02-08 16:59:29 -08:00
John D Pell
f6119567e8 plugin/history*search: no need to load after plugin/history
There's no need for these plugins to load after `plugin/history`. None of the history plugins depend upon each other loading before, after, or at all.
2022-02-08 16:59:29 -08:00
John D Pell
267a721ac6 plugin/history-eternal: Use readonly instead of export
...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
2022-02-08 16:59:29 -08:00
John D Pell
8052911861 plugin/history: don't use export
...so the plugin is friendly to variables already marked read-only.
2022-02-08 16:59:29 -08:00
Gurkirat Singh
70dbda053b Remove redundant aliases for clear screen 2022-02-08 14:49:43 +05:30
John D Pell
00e3955dd3 lib/preview: add full completion 2022-02-07 15:27:03 -08:00
John D Pell
a9a40a3cad lib/helpers: add preview to bash-it spaghetti 2022-02-07 15:27:03 -08:00
John D Pell
d6555f369a lib/preview: refactor into a function
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.
2022-02-07 15:27:03 -08:00
John D Pell
1480cdfa34 completion/system: correctly load version when not linked
- Load the correct version of `bash-completion` even when not "linked".
2022-02-07 15:15:46 -08:00
John D Pell
bc95eceb10 main: adopt _bash-it-log-prefix-by-path() 2022-02-06 16:59:03 -08:00
John D Pell
0d346b204f main: Glob for *.bash properly when path contains spaces
- `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.
2022-02-06 16:59:03 -08:00
Noah Gorny
4dbe92e38d Merge pull request #2075 from NariyasuHeseri/awk_unterminated_regexp
helpers: fix `awk: unterminated regexp`
2022-02-04 11:52:21 +02:00
John D Pell
43df0fe130 completion/aliases: rename init function
Use the callback naming convention for the init function, for later use.
2022-02-03 22:49:39 -08:00
John D Pell
302bae9c5f test/battery: require matching battery identifier 2022-02-03 16:47:17 -08:00
John D Pell
23f7916a4d test/battery: add multiple-battery edge case 2022-02-03 10:45:27 -08:00
John D Pell
cade0a1e7a plugin/battery: split upower to two variables 2022-02-03 10:45:27 -08:00
Nariyasu Heseri
1e77c26c00 helpers: fix awk: unterminated regexp 2022-01-31 23:54:14 +09:00
John D Pell
880488ec9a completion/alias: add stub file
- put a loader to remove the symlink at `enabled/***---alias-completion.plugin.bash`.
2022-01-30 16:13:54 -08:00
John D Pell
b0862899d7 completion/alias: fix tests 2022-01-30 16:13:54 -08:00
John D Pell
7fcad6ed0d completion/alias: rename
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.
2022-01-30 16:13:54 -08:00
John D Pell
d214621d39 completion/alias: shfmt && shellcheck 2022-01-30 16:13:54 -08:00
John D Pell
b0f23d8e98 completion/alias: eliminate use of eval 2022-01-30 16:13:54 -08:00
Noah Gorny
578c702ca3 Merge pull request #2055 from gaelicWizard/lib/reloader
lib/reloader: lint and modernize
2022-01-30 00:10:32 +02:00
Noah Gorny
2a9ee7e344 Merge pull request #2019 from gaelicWizard/lib/colors
lib/colors: split out metaprogramming
2022-01-30 00:10:14 +02:00
Noah Gorny
39e5652ee5 Merge pull request #1932 from gaelicWizard/search
Lib/search: lint, cleanup, and small fixes
2022-01-30 00:09:49 +02:00
Noah Gorny
1d6f4d747b Merge pull request #2067 from gaelicWizard/BASH_IT_BASHRC
lib/helpers: eliminate assumptions about login shells
2022-01-29 22:42:21 +02:00
Nariyasu Heseri
c794f4f0e7 plugin/battery: use --max-count of grep instead of head 2022-01-29 15:50:36 +09:00
John D Pell
26b402e254 lib/reloader: unset "${!_bash_it_reloader_@}" 2022-01-28 13:58:00 -08:00
John D Pell
4cf2aae36e lib/search: code cleanup
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()`.
2022-01-28 13:35:17 -08:00
John D Pell
b8694ee140 lib/search: shfmt
My apologies to future `git blame` hunters ♥
2022-01-28 13:35:17 -08:00
John D Pell
8939e943c5 lib/search: fix usage statement _bash-it-search()
SC2154
2022-01-28 13:35:17 -08:00
John D Pell
64efe52394 lib/search: fix _bash-it-flash-term()
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.
2022-01-28 13:35:17 -08:00
John D Pell
afeb4d6e11 lib/search: shellcheck
SC2076
SC2091
SC2004
SC2086
SC2207
2022-01-28 13:35:17 -08:00
John D Pell
5478617a89 lib/search: code style cleanup
Couldn't even `shellcheck` until I did a first pass...too much noise! ♥
2022-01-28 13:35:17 -08:00
John D Pell
85a77f1e46 lib/colors: Separate metaprogramming 2022-01-28 13:09:53 -08:00
John D Pell
bf4ddf5951 plugin/colors: shfmt 2022-01-28 13:09:00 -08:00
John D Pell
399f0265aa plugin/colors: revert #699
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?
2022-01-28 13:09:00 -08:00
John D Pell
5f19de8d51 plugin/colors: rename theme/colors 2022-01-28 13:09:00 -08:00
John D Pell
16cee1956d lib/colors: revert #99
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.
2022-01-28 13:08:50 -08:00
John D Pell
2a8d8ba540 lib/colors: rename theme/colors 2022-01-28 13:08:50 -08:00
Nariyasu Heseri
b87f3067b5 plugin/battery: bug fix
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.
2022-01-29 03:30:35 +09:00
John D Pell
fd7b20b8d7 reloader: shellcheck && shfmt
Rewrite globbing per `shellcheck`'s SC2013 recommendations, and standardize whitespace.
2022-01-28 03:59:45 -08:00
John D Pell
75d22d865f lib/reloader: adopt _bash-it-log-prefix-by-path() 2022-01-28 03:59:45 -08:00
John D Pell
c08267e25d lib/helpers: eliminate assumptions about login shells
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.
2022-01-28 03:59:02 -08:00
Noah Gorny
7e79212dff Merge pull request #2072 from gaelicWizard/lib/preexec
lib/preexec: tests!
2022-01-27 23:55:21 +02:00
John D Pell
2343e2dd35 lib/preexec: tests! 2022-01-27 12:40:38 -08:00
John D Pell
d1d7cd4383 tests: add *.bats to .editorconfig 2022-01-27 11:30:35 -08:00
Noah Gorny
056c392a54 lib: preexec: Properly return if there was a conflict in check_*_conflict
It goes the other way around!
2022-01-26 18:25:37 +02:00
Noah Gorny
0c24edae06 Merge pull request #2064 from gaelicWizard/plugin/battery
plugin/battery: `shellcheck`
2022-01-26 17:47:59 +02:00
Noah Gorny
3c2bc3d196 Merge pull request #2003 from gaelicWizard/preexec
Consolidate `preexec`-related functions; Eliminate `vendor/init.d`
2022-01-26 17:34:46 +02:00
Noah Gorny
5a849419ba Merge pull request #2040 from gaelicWizard/parallel
CI: install `parallel` on OSX
2022-01-26 17:29:26 +02:00
John D Pell
3cb5f3f7e6 plugin/battery: shellcheck 2022-01-25 23:54:24 -08:00
John D Pell
eeaf59b439 CI: install parallel on OSX
This should (hopefully) speed up tests!
2022-01-25 13:38:41 -08:00
John D Pell
ae8c9c08a3 lib/preexec: trim whitespace
Alsö, use `_bash-it-array-contains-element()`
2022-01-25 13:00:04 -08:00
John D Pell
7770e8cbb9 lib/preexec: log an error if bash-preexec not loaded 2022-01-25 13:00:04 -08:00
John D Pell
9f146f937a lib/preexec: consolidate helper functions
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()`.
2022-01-25 13:00:04 -08:00
John D Pell
7a0b353cea lib/preexec: rename vendor/init.d/preexec.bash 2022-01-25 13:00:04 -08:00
Noah Gorny
2575d64deb Merge pull request #2010 from gaelicWizard/plugin-projects
Plugin/projects: cleanup
2022-01-25 18:28:53 +02:00
Noah Gorny
44a1b55db7 Merge pull request #2037 from gaelicWizard/theme/brunton
theme/brunton: `shellcheck`
2022-01-25 18:18:54 +02:00
Noah Gorny
878bbe5942 Merge pull request #2042 from gaelicWizard/completion/dotnet
completion/dotnet: new completion
2022-01-25 18:16:06 +02:00
Noah Gorny
dd83efc35f Merge pull request #2041 from gaelicWizard/theme/sudo
lib/theme: disable THEME_CHECK_SUDO
2022-01-25 18:12:47 +02:00
Noah Gorny
035eabade6 Merge pull request #2036 from gaelicWizard/theme/norbu
theme/norbu: `shellcheck` && `shfmt`
2022-01-25 18:10:21 +02:00
Noah Gorny
80c52b4c25 Merge pull request #2049 from gaelicWizard/CI
CI: fix version of OSX runner
2022-01-25 18:07:46 +02:00
Noah Gorny
dcb7038ca3 Merge pull request #2034 from gaelicWizard/README
README: Display latest build status from default branch
2022-01-25 17:57:06 +02:00
Noah Gorny
457a279263 Merge pull request #2029 from gaelicWizard/completion/bash-it
completion/bash-it: lint and simplify
2022-01-25 17:56:34 +02:00
John D Pell
b1e922ea38 theme/norbu: shellcheck && shfmt
# Conflicts:
#	clean_files.txt
2022-01-25 00:01:27 -08:00
John D Pell
4779c8c380 README: Display latest build status from current branch
This displays the build/test status of the latest commit to HEAD, not neccessarily `master` branch, from whichever fork it's read from.
2022-01-24 21:53:57 -08:00
John D Pell
5f9a3f143f completion/bash-it: rename _bash-it-comp()
...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.
2022-01-24 21:41:23 -08:00
John D Pell
2f4ed49a71 completion/bash-it: adopt _compreply_candidates() 2022-01-24 21:41:13 -08:00
John D Pell
e1e971c0ea completion/bash-it: use read -a to populate $COMPREPLY
This allows for spaces and special characters in file names, i.e. internaltional/unicode words.
2022-01-24 21:41:13 -08:00
John D Pell
3874ad85c2 completion/bash-it: use existing functions 2022-01-24 21:41:13 -08:00
John D Pell
d7695d5456 completion/bash-it: shfmt 2022-01-24 21:41:13 -08:00
Noah Gorny
dbb3ea4736 Merge pull request #2035 from gaelicWizard/theme/pete
theme/pete: `shellcheck` && `shfmt`
2022-01-24 23:32:58 +02:00
Noah Gorny
edc36795b5 Merge pull request #2030 from gaelicWizard/bats
Update BATS
2022-01-24 23:29:00 +02:00
Noah Gorny
7e54aea8c7 Merge pull request #1934 from gaelicWizard/helpers
lib/helpers: lint, cleanup, & improvements
2022-01-24 23:28:03 +02:00
Noah Gorny
4ba1ab9fd7 Merge pull request #2018 from gaelicWizard/lib/helpers-base
lib/helpers: fix `_command_exists()`
2022-01-24 23:27:05 +02:00
John D Pell
18536ed892 template: Add $THEME_CHECK_SUDO 2022-01-24 11:46:16 -08:00
John D Pell
21942f6275 lib/theme: disable THEME_CHECK_SUDO
Move `$THEME_CHECK_SUDO` to `lib/them`, and set it to `false` instead of `true`.
2022-01-24 11:46:16 -08:00
souhaiebtar
a312e5a9b9 fix wrong function name in helpers.bash
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`
2022-01-22 12:33:33 +00:00
John D Pell
a78d72eed1 plugin/projects: refactor a bit 2022-01-18 20:47:08 -08:00
John D Pell
46df804ad9 CI: fix version of OSX runner
Now that Mac OS X is "version 11", the "minor" version is no longer relevant.

Alsö, clean up the run conditions.
2022-01-18 16:36:19 -08:00
John D Pell
1ec48c8d71 plugin/projects: add to template/bash_profile 2022-01-18 11:08:51 -08:00
John D Pell
ea2002a2e4 plugin/projects: cleanup
I'm deliberately leaving the possibility that one might `pjo` without a project name...
2022-01-18 11:08:51 -08:00
John D Pell
0f0093dd4b lib/helpers: quotes for consistency
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
2022-01-18 11:06:21 -08:00
John D Pell
dfc3fa4339 lib/helpers: delete _bash-it-determine-component-status-from-path()
Duplicate function of existing `_bash-it-component-item-is-enabled()`.
2022-01-18 11:06:21 -08:00
John D Pell
62b5297dc2 lib/utilities: autonomize _bash-it-component-item-is-enabled() 2022-01-18 11:06:21 -08:00
John D Pell
22b290b94f lib/helpers: simplify some functions
- add some `local` variables,
- don't subshell `_typeset_functions`,
2022-01-18 11:02:37 -08:00
John D Pell
bc25810069 lib/helpers: juse use awk, insteado of grep | awk 2022-01-18 11:02:37 -08:00
John D Pell
805eab804c lib/helpers: fix profile subcommand tests 2022-01-18 11:02:37 -08:00
John D Pell
4719e43d0b lib/helpers: remove weird non-globs
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
2022-01-18 11:02:37 -08:00
John D Pell
251e23a3fa lib/helpers: use awk to count lines instead of piping to wc -l
Co-authored-by: Kostas Giapis <45879751+tsiflimagas@users.noreply.github.com>
2022-01-18 11:02:37 -08:00
John D Pell
317ff77810 lib/helpers: be extra careful with word splitting
Use curly braces when `$1` is unseparated from words in a string.
2022-01-18 11:02:37 -08:00
John D Pell
550f808884 lib/helpers: fix _bash-it-describe()
Use `_bash-it-component-item-is-enabled()`

Fix SC2295
2022-01-18 11:02:37 -08:00
John D Pell
4c473853e9 lib/helpers: cleanup
- 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.)
2022-01-18 11:02:37 -08:00
John D Pell
003b0ce802 lib/helpers: shfmt
My apologies to future `git blame` hunters ♥
2022-01-18 11:02:36 -08:00
John D Pell
6ed006a167 lib/helpers: second shellcheck pass
lib/helpers: lint `_bash-it-migrate()`

lib/helpers: lint `_disable-thing()`

lib/helpers: lint `_enable-thing()`

lib/helpers: lint `_help-list-aliases()`

lib/helpers: lint `_help-plugins()`

lib/helpers: some SC2034 fixes

And SC2154 in `_make_reload_alias()`

lib/helpers: lint `all_groups()`
2022-01-18 11:02:21 -08:00
John D Pell
5eab3bd288 lib/helpers: first shellcheck pass
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...
2022-01-18 11:02:21 -08:00
John D Pell
9b51dc0b5f lib/helpers: fix _command_exists()
The weird subshell is weird AF. Just do a normal `if`.

Ditto `_binary_exists()`, `_completion_exists()`, and `_is_function()`!
2022-01-18 11:02:10 -08:00
John D Pell
180fb93df8 lib/helpers: fix all_groups()
- 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
```
2022-01-18 11:02:10 -08:00
Noah Gorny
973a1f9b40 Merge pull request #1958 from gaelicWizard/plugin-proxy
plugin/proxy: lint
2022-01-18 19:42:32 +02:00
Noah Gorny
e116288b83 Merge pull request #2027 from gaelicWizard/lib/composure
Update `vendor/composure`
2022-01-18 19:40:41 +02:00
Noah Gorny
fd35094463 Merge pull request #2004 from gaelicWizard/finalize
Create lib finalize hook
2022-01-18 19:40:05 +02:00
Noah Gorny
8d5d9073ce Merge pull request #1999 from gaelicWizard/utilities
lib/utilities: refactor `_bash-it-pluralize-component()` & other improvements
2022-01-18 19:39:45 +02:00
Noah Gorny
bdf9a2bca3 Merge pull request #1959 from gaelicWizard/log
Lib/log: linting and small improvements
2022-01-18 19:39:24 +02:00
John D Pell
77c5f8eda9 completion/dotnet: modernize
and `shfmt`
2022-01-12 22:39:49 -08:00
John D Pell
1a48bcc852 completion/dotnet: new completion
See: https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
2022-01-12 22:20:25 -08:00
John D Pell
27ebc585be theme/brunton: SC2154
Handle all unbound parameters, even colors!
2022-01-12 13:38:10 -08:00
John D Pell
8e8fe69db4 theme/pete: shellcheck && shfmt 2022-01-12 13:29:40 -08:00
John D Pell
9291b46b15 test_lib: update BATS to latest tag(s)
And fix any failing tests.
2022-01-10 00:27:39 -08:00
John D Pell
d4b4995e2a Update "composure" from "https://github.com/erichs/composure@master"
git-vendor-name: composure
git-vendor-dir: vendor/github.com/erichs/composure
git-vendor-repository: https://github.com/erichs/composure
git-vendor-ref: master
2022-01-09 00:54:30 -08:00
John D Pell
7430a06ec2 lib/utilities: Use variable indirection
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.
2022-01-09 00:53:39 -08:00
John D Pell
2b5e531396 lib/utilities: update _bash-it-component-cache-file()
Match idiom of `_bash-it-component-singularize()`
2022-01-09 00:53:39 -08:00
John D Pell
4f700dfb3b lib/utilities: rewrite _bash-it-component-pluralize
Fix up and rename `_bash-it-pluralize-component()` to `_bash-it-component-pluralize()`, and add matching function `_bash-it-component-singularize()`.
2022-01-09 00:53:39 -08:00
John D Pell
c3eaa606de lib/utilities: fix _bash-it-component-help() for long component names
Alsö, minor tweak to `_bash-it-array-contains-element()` for clarity.

This fixes Bash-It/bash-it#1978.
2022-01-09 00:53:39 -08:00
John D Pell
e3bd30f98d lib/utilities: autonomize _bash-it-component-item-is-enabled()
Make `_bash-it-component-item-is-enabled()` operate *without* using `_bash-it-component-help()`...so it's now *much* faster.
2022-01-09 00:53:39 -08:00
John D Pell
e71ea4ad02 lib/log: function _bash-it-log-prefix-by-path()
...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.
2022-01-09 00:49:44 -08:00
John D Pell
6dec28b5df lib/log: rename _log_general()
...to `_bash-it-log-message()`.

alsö, add common log levels with common names.
2022-01-09 00:49:44 -08:00
John D Pell
b772e6ace7 lib/log: shellcheck && shfmt
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 ♥
2022-01-09 00:49:44 -08:00
John D Pell
dc45958a8e finalize: first attempt at documentation? 2022-01-09 00:46:51 -08:00
John D Pell
bdaf29f84c Create lib finalize hook
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.
2022-01-09 00:46:51 -08:00
John D Pell
6e480d7a8a plugin/proxy: shellcheck && shfmt
plugins/proxy: use `_command_exists()`

Alsö, quote variables, handle unbound parameters, &c.
2022-01-09 00:40:49 -08:00
Noah Gorny
86c1e3c043 Merge pull request #1980 from gaelicWizard/themes-SC2154-B
Themes: `shellcheck` (SC2154); Part B
2022-01-09 01:13:49 +02:00
Noah Gorny
f2bff34493 Merge pull request #2013 from gaelicWizard/completion/system
completion/system: load earlier than others
2022-01-09 01:13:23 +02:00
Noah Gorny
1fd601db7f Merge pull request #2007 from gaelicWizard/plugin-latex
Plugin/LaTeX: 2009 was thirteen years ago
2022-01-09 01:11:41 +02:00
Noah Gorny
21e7c1f00c Merge pull request #2011 from gaelicWizard/plugin-nginx
plugin/nginx: cleanup
2022-01-09 01:11:06 +02:00
Noah Gorny
af801cfadc Merge pull request #2014 from gaelicWizard/plugin/gif
plugin/GIF: use `type -p` and lint
2022-01-09 01:10:43 +02:00
Noah Gorny
46f343461c Merge pull request #1953 from gaelicWizard/SVN
completion/svn: import existing, remove copy
2022-01-09 01:10:16 +02:00
Noah Gorny
4ec1b5f3e7 Merge pull request #2002 from gaelicWizard/bats
tests: path quoting and boilerplate
2022-01-09 01:04:12 +02:00
John D Pell
fcbe4e90b7 theme/easy: SC2154
Handle all unbound parameters, even colors!
2022-01-08 08:45:52 -08:00
John D Pell
c7c447a54b theme/candy: SC2154
Handle all unbound parameters, even colors!
2022-01-08 08:45:52 -08:00
John D Pell
262e55eda2 theme/bobby: SC2154
Handle all unbound parameters, even colors!
2022-01-08 08:45:52 -08:00
John D Pell
6db5f38f6e theme/atomic: lint/cleanup
Use `[[` instead of `[`, set some local variables, still more to clean
2022-01-08 08:45:35 -08:00
John D Pell
079652e6e7 plugin/nginx: cleanup
Dont overwrite user-set variable, and quote path. Local some variables, `shellcheck`, `shfmt`
2022-01-08 08:44:05 -08:00
John D Pell
2fe9e01051 plugins/latex: 2009 was 12 years ago
Locate the currently installed edition, instead of transpoting us back to undergrad.
2022-01-08 08:43:32 -08:00
John D Pell
ce22710e00 plugin/gif: shfmt
My apologies to future `git blame` hunters ♥
2022-01-08 08:43:17 -08:00
John D Pell
b1b08de626 plugins/gif: use type -p 2022-01-08 08:43:00 -08:00
John D Pell
04c7424de5 completion/system: fix tests for profile command 2022-01-08 08:33:16 -08:00
John D Pell
5fab574bfd completion/system: shfmt
My apologies to future `git blame` hunters ♥
2022-01-08 08:33:16 -08:00
John D Pell
e7c3263f12 completion/system: load earlier than other completions
I chose `325` so that it's still possible to deliberately place something *before* this component, if needed somehow.
2022-01-08 08:33:16 -08:00
John D Pell
776d0b7d37 completion/svn: rename to match prior file
This way, users don't need to enable "subversion" if they had already enabled "svn".
2022-01-08 08:32:37 -08:00
John D Pell
ae5131aee2 completion/subversion: load system completion
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.
2022-01-08 08:32:37 -08:00
John D Pell
bb69edd795 completion/subversion: remove
Remove duplicate of subversion completion as it is already provided by system packages.
2022-01-08 08:32:37 -08:00
John D Pell
8a226a73f1 test/test-helper: support 'plumbing' metadata 2022-01-08 08:29:13 -08:00
John D Pell
30ca1bfba2 test/test_helper: exclude bad symlink
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()`.
2022-01-08 08:29:13 -08:00
John D Pell
97ef5a8087 test/run: lint 2022-01-08 08:29:13 -08:00
John D Pell
61e1d6aec2 lib/utilities: simplify test flow
This subshell is...wut
2022-01-08 08:29:13 -08:00
John D Pell
c35ed44cbf plugins/ruby: tests on Mac OS X
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.
2022-01-08 08:29:13 -08:00
John D Pell
21a2198a12 test/theme: make fewer assumptions
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.
2022-01-08 08:29:13 -08:00
John D Pell
6030767b4e test/theme: load colors 2022-01-08 08:29:13 -08:00
John D Pell
da6b27166f tests: new file test_helper_libs.bash
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.
2022-01-08 08:29:13 -08:00
John D Pell
9dcbeec7ad tests: test_helper already loads composure.sh
...and `cite()`s metadata
2022-01-08 08:29:13 -08:00
John D Pell
b2279b7237 tests: quote paths 2022-01-08 08:29:13 -08:00
Noah Gorny
b846c86dbb Merge pull request #1991 from noviicee/issue-1206
Added alias ls='ls -F'
2022-01-07 09:10:44 +02:00
Noah Gorny
2e968c459c Merge pull request #1989 from tsiflimagas/bashit-completions-performance
Bash-it completions performance improvement
2022-01-07 08:55:46 +02:00
Noah Gorny
6fc47a7671 Merge pull request #2021 from NariyasuHeseri/master
theme/powerline: fix error `scm: parameter not defined`
2022-01-07 08:51:00 +02:00
Noah Gorny
931f27ee3e Merge pull request #2016 from gaelicWizard/plugin/python
plugin/python: OS detection & `shfmt`
2022-01-07 08:50:07 +02:00
Noah Gorny
2728f20354 Merge pull request #2012 from gaelicWizard/theme/essential
theme/essential: cleanup
2022-01-07 08:48:16 +02:00
Noah Gorny
a538844c3b Merge pull request #1997 from georgettica/patch-1
feat(git): make auto squashing non-interactive
2022-01-07 08:46:58 +02:00
Noah Gorny
c060eb46ea Merge pull request #2001 from gaelicWizard/plugin-dirs
Plugin/dirs: use `$XDG_STATE_HOME`
2022-01-07 08:42:24 +02:00
Noah Gorny
dba610cdc8 Merge pull request #2009 from gaelicWizard/plugin-man
Plugin/man: Add `R` to `$LESS`
2022-01-07 08:41:41 +02:00
Noah Gorny
5d68fca7e5 Merge pull request #2008 from gaelicWizard/plugin-osx
Plugin/OSX: cleanup
2022-01-07 08:41:17 +02:00
Noah Gorny
48a1ff7fb4 Merge pull request #2005 from gaelicWizard/plugin-todo
Plugin/todo: cleanup and simplify
2022-01-07 08:40:52 +02:00
Noah Gorny
682b51c195 Merge pull request #2015 from gaelicWizard/plugin/git-subrepo
plugin/git-subrepo: use `$HOME` instead of `~`
2022-01-07 08:31:49 +02:00
Nariyasu Heseri
9d8002226d theme/powerline: fix error scm: parameter not defined 2022-01-06 18:44:18 +09:00
John D Pell
139baedf5d plugin/python: Pyton 2 is dead; Long Live Python 3! 2022-01-05 13:29:35 -08:00
John D Pell
f2dcb2aff6 theme/essential: s/echo/printf/g 2022-01-03 20:45:39 -08:00
John D Pell
3695862b43 theme/essential: cleanup
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`.
2022-01-03 20:45:39 -08:00
John D Pell
d1b7166358 theme/essential: shfmt 2022-01-03 20:45:39 -08:00
John D Pell
9f79848eed theme/essential: SC2154
Handle all unbound parameters, even colors!
2022-01-03 20:45:39 -08:00
noviicee
1305a86136 Changed alias name 2022-01-03 23:43:40 +05:30
noviicee
201827ddff Merge branch 'master' of git://github.com/Bash-it/bash-it into issue-1206 2022-01-03 23:38:33 +05:30
Noah Gorny
c81c9dcc8c Merge pull request #1865 from NoahGorny/add-profile-subcommand
add profile subcommand
2022-01-03 14:00:39 +02:00
Noah Gorny
f0abc3fbc4 Merge pull request #1998 from tsiflimagas/fzf-plugin
Fix checking whether fzf is already in PATH
2022-01-03 13:33:14 +02:00
John D Pell
29216c0fd4 plugin/python: shfmt
My apologies to future `git blame` hunters ♥
2022-01-01 23:00:48 -08:00
John D Pell
dd911f1256 plugins/python: code style improvements
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.
2022-01-01 23:00:48 -08:00
John D Pell
c030f2108b plugin/git-subrepo: shellcheck 2022-01-01 22:48:01 -08:00
John D Pell
a99b597217 plugin/git-subrepo: use $HOME instead of ~
If the outer variable is double-quoted, then the default expansion when undefined does not get tilde-expanded. Use `$HOME`.
2022-01-01 22:32:03 -08:00
John D Pell
d6bcedfa96 plugin/base: rewrite t() function to use todo.sh
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.
2022-01-01 17:50:55 -08:00
John D Pell
02b57a83ef plugins/todo: lint
plugin/base: use `_bash-it-component-item-is-enabled()`
2022-01-01 17:50:55 -08:00
John D Pell
45aeb86c21 plugin/osx-timemachine: abuse $SUDO_COMMAND
Use `$SUDO_COMMAND` as a back-channel to `ssh-askpass` to set a reasonable title if it pops up.
2022-01-01 17:50:22 -08:00
John D Pell
03653fc141 plugins/osx-timemachine: shellcheck && shfmt
Use bash functionality rather than external binaries. Alsö, if $SUDO_ASKPASS is set then pass -A to sudo.
2022-01-01 17:50:22 -08:00
John D Pell
caa0d48c60 plugin/osx: move $OSTYPE check to top of file 2022-01-01 17:50:22 -08:00
John D Pell
db9027989d plugin/osx: remove dock-switch()
...it hasn't worked in *years*
2022-01-01 17:50:22 -08:00
John D Pell
75aabd5d20 plugin/osx: shellcheck && shfmt
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).
2022-01-01 17:50:22 -08:00
John D Pell
dc5c9e107c plugin/man: simplify
Don't overwrite variables that the user has already set.

plugins/man: unbound `$LESS`
2022-01-01 17:49:45 -08:00
John D Pell
290aab4efe plugins/man: Add "R" to $LESS
Otherwise, `-R` must be added on the command line or colors just won't be rendered and these variables will be ignored.
2022-01-01 17:49:45 -08:00
John D Pell
8b308df939 plugin/dirs: use $BASH_IT_DIRS_BKS.new instead of ~/.dirs1 2022-01-01 17:49:15 -08:00
John D Pell
71b4f3c1bc plugin/dirs: shfmt && shellcheck 2022-01-01 17:49:15 -08:00
John D Pell
d8e7b173b5 plugins/dirs: use XDG_STATE_HOME
Locate the bookmarks file in $XDG_STATE_HOME, and migrate an existing file from the old location if it exists.
2022-01-01 17:49:15 -08:00
John D Pell
4abafc55ef tests: quote paths 2022-01-01 17:46:11 -08:00
Noah Gorny
2e51e92699 Merge pull request #2000 from gaelicWizard/lint
Revert most of "Fix linting errors that snuck in."
2022-01-01 23:01:09 +02:00
Noah Gorny
c5d3b258ab Merge pull request #2006 from gaelicWizard/plugin-java
Plugin/Java: quote path and provide useful error message
2022-01-01 22:56:21 +02:00
Noah Gorny
2dd4426a7c Merge branch 'master' into plugin-java 2022-01-01 22:53:18 +02:00
Noah Gorny
c852360a39 Merge pull request #1977 from gaelicWizard/themes-SC2154-A
Themes: fix `shellcheck` (SC2154); Part A
2022-01-01 22:51:35 +02:00
Noah Gorny
f534505357 Merge pull request #1969 from gaelicWizard/plugin-jekyll
Plugin/jekyll: lint and stuff
2022-01-01 22:43:36 +02:00
Noah Gorny
475952dbb9 Merge pull request #1928 from gaelicWizard/defaults
Refactor completion for `defaults` command
2022-01-01 16:46:14 +02:00
John D Pell
33df3a2bcd plugin/java: show message on missing *or* blank 2021-12-30 22:35:34 -08:00
John D Pell
f03a89836e plugins/java: quote path && shfmt
Provides an error message if no file is specified.
2021-12-30 20:25:19 -08:00
Kostas Giapis
45e8c4e3cd Handle restart completions 2021-12-30 17:03:23 +02:00
Kostas Giapis
2a2cc72541 Make parameter truncation greedy 2021-12-30 17:01:22 +02:00
Kostas Giapis
1c03eb6b3b Fix checking whether fzf is already in PATH 2021-12-28 06:54:25 +02:00
John D Pell
64f75ce22d Revert most of "Fix linting errors that snuck in."
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.
2021-12-27 16:18:20 -08:00
John D Pell
3fe9c8d6bc plugin/jekyll: try to shorten the flow
Alsö, use `pushd`/`popd` instead of `builtin cd`.

Alsö, SC2153
2021-12-27 12:22:42 -08:00
John D Pell
e38eeefc5f plugin/jekyll: second shellcheck pass 2021-12-27 12:22:42 -08:00
John D Pell
c0aad51afd main: move Jekyll stuff to plugins/jekyll
If the user doesn't load the Jekyll plugin, then don't load any Jeykll stuff.
2021-12-27 12:22:42 -08:00
John D Pell
1c3a7ffdb3 plugin/jekyll: shfmt && shellcheck
Use bashisms, remove suplerfous variable, use parameter default value replacement
2021-12-27 12:22:42 -08:00
John D Pell
2991aa66ca theme/powerline: SC2154, SC2248 2021-12-27 12:20:46 -08:00
John D Pell
c323357067 theme/purity: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell
e560e88814 theme/pure: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell
895102edeb theme/codeword: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell
4bc83d7940 theme/bira: SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell
2c14a18483 theme/bakke: fix SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell
c769234350 theme/90210: fix SC2154
Handle all unbound parameters, even colors!
2021-12-27 12:20:46 -08:00
John D Pell
6a41dbc3f6 Add "bash-progcomp" from "https://github.com/gaelicWizard/bash-progcomp@v2.0.1"
git-vendor-name: bash-progcomp
git-vendor-dir: vendor/github.com/gaelicWizard/bash-progcomp
git-vendor-repository: https://github.com/gaelicWizard/bash-progcomp
git-vendor-ref: v2.0.1
2021-12-27 11:36:38 -08:00
John D Pell
fdb50aec6b Remove defaults completion v1 2021-12-27 11:36:38 -08:00
Ron Green
559cde151b feat(git): make auto squashing non-interactive 2021-12-22 18:49:39 +02:00
Noah Gorny
84383cb46b Merge pull request #1994 from Novite5/master
"pipenv --completion" is obsoleted
2021-12-18 21:52:29 +02:00
Noah Gorny
8edbdf9bbd Merge pull request #1992 from davidpfarrell/dirs
plugin(dirs): remove shopt -s cdable_vars
2021-12-18 21:52:18 +02:00
Novite5
1065d98dbe "pipenv --completion" is obsoleted
Reference: https://buildmedia.readthedocs.org/media/pdf/pipenv/latest/pipenv.pdf 4.2.18 Shell Completion
2021-12-12 18:11:21 +08:00
Kostas Giapis
476159eab9 Use bash features as much as possible 2021-12-11 17:48:33 +02:00
Kostas Giapis
15fe122c1f Make more variables local 2021-12-03 06:31:28 +02:00
Kostas Giapis
4d821338a3 Double quote some variables 2021-12-03 06:31:28 +02:00
Kostas Giapis
9c4f7773b9 Improve performance for the rest of bash-it completions 2021-12-03 06:31:16 +02:00
Kostas Giapis
5b29d3c6e6 Improve performance of 'bash-it enable' completions 2021-12-03 06:29:39 +02:00
David Farrell
1bc56b1d8f plugin(dirs): remove shopt -s cdable_vars 2021-12-02 13:42:29 -08:00
noviicee
51042c2cf0 added alias ls='ls -F' 2021-12-02 23:49:58 +05:30
cornfeedhobo
1882f50aa1 Merge pull request #1982 from cornfeedhobo/align-history-plugins
Wholesale cleanup of all history plugins
2021-12-02 09:44:09 -06:00
cornfeedhobo
2c8ee40566 Fix linting errors that snuck in. 2021-12-02 09:14:01 -06:00
cornfeedhobo
bdb5289660 Wholesale cleanup of all history plugins
- 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
2021-12-02 09:13:56 -06:00
Noah Gorny
036cf8ada0 Merge pull request #1987 from mikejamestx/dtml-scm_prompt
Themes: Fix doubletime_multiline scm_prompt
2021-11-29 23:59:24 +02:00
Mike James
1273504267 themes: fix doubletime_multiline scm_prompt
Replace doubletime_scm_prompt with scm_prompt.
2021-11-26 13:21:07 -08:00
Noah Gorny
8784ed2785 Merge pull request #1986 from ajeetdsouza/zoxide
plugin: add zoxide
2021-11-24 21:43:39 +02:00
Ajeet D'Souza
a89f2f8f13 plugin: add zoxide 2021-11-24 16:49:46 +05:30
Noah Gorny
447c89aa0e Merge pull request #1981 from william-richard/make-default-branch-match-exactly-main
Look for branches that are literally the word main
2021-11-16 20:09:22 +02:00
William Richard
2a23598873 Make the regex looking for the main branch match the entire line 2021-11-15 12:19:05 -05:00
Noah Gorny
7b4056fdf9 Merge pull request #1984 from NoahGorny/docs-pin-docutils
docs: Pin docutils to 0.17.1
2021-11-13 20:25:33 +02:00
Noah Gorny
1ff2497c9e docs: Pin docutils to 0.17.1
Seems like docutils 0.18 has some problems and it is breaking our docs
build
(https://issues.apache.org/jira/browse/FLINK-24662)

Lets use 0.17.1 for now.
2021-11-12 19:14:22 +02:00
Noah Gorny
ab3b8b8f22 Merge pull request #1979 from gaelicWizard/preexec-histcontrol
preexec: work around upstream mangling of `$HISTCONTROL`
2021-11-01 23:25:02 +02:00
William Richard
daaab1b73d Use \s instead of \b
\b matches things like - and _, which is often used in branch names
2021-10-25 11:55:26 -04:00
William Richard
98bd0ae149 Use /b to find the default branch, instead of start/end of line 2021-10-25 11:35:19 -04:00
Noah Gorny
c90a6283ef Merge pull request #1976 from gaelicWizard/utilities
Use `_bash-it-egrep()`
2021-10-23 23:33:04 +03:00
William Richard
a14d9cb6ea Look for branches that are literally the word main
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.
2021-10-22 11:19:21 -04:00
John D Pell
bdfb987f0c plugin/xterm: don't rely on $1
_bash-preexec_ passes the "current" command line as `$1`, but this is unreliable and we explicitly discourage it's use.

Use `$BASH_COMMAND` instead.
2021-10-20 15:50:15 -04:00
John D Pell
9ce199c251 preexec: set options before load
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.
2021-10-20 15:28:59 -04:00
John D Pell
00f5f2a62e Use _bash-it-egrep() 2021-10-18 22:08:56 -04:00
Noah Gorny
2d1bd82575 Merge pull request #1975 from krapshsa/krapshsa-patch-1
Fix save-and-reload-history command not found
2021-10-18 22:22:21 +03:00
Noah Gorny
5e3810ac96 Merge pull request #1973 from gaelicWizard/utilities
lib/utilities: minor improvements
2021-10-18 22:05:05 +03:00
Noah Gorny
5feebcc9d9 Merge pull request #1974 from zou000/patch-1
Fix home dir substitution
2021-10-18 21:59:59 +03:00
krapshsa
b0e8729b0f Fix save-and-reload-history command not found 2021-10-19 00:58:01 +08:00
John D Pell
253d1213e0 lib/utilities: new function _bash-it-egrep()
The existing function `_bash-it-grep()` is weird. New function `_bash-it-egrep()` just does the thing without requiring two subshells and manual invocation.
2021-10-18 09:14:32 -04:00
John D Pell
b8ee63c67d lib/utilities: quote SC2295
Doesn't show up on my shellcheck 0.7.2, but does for NoahGorny!
2021-10-18 09:14:32 -04:00
John D Pell
b986c39040 lib/utilities: XDG_CACHE_HOME
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 resolves Bash-It/Bash-It#1904.
2021-10-18 09:14:32 -04:00
Noah Gorny
7987e4bfcd Merge pull request #1883 from seefood/ira/autosave-history-plml
Add history flushes on each command to the powerline themes
2021-10-17 19:51:56 +03:00
zou000
7911f770cf use \w 2021-10-16 22:29:25 -07:00
zou000
bb3a51f742 Update powerline.base.bash 2021-10-16 20:24:07 -07:00
zou000
413d7a1326 Fix home dir substitution
See the discussions in 953e422bed (commitcomment-58148656) . Tested with bash 5.1 and  bash 3.2
2021-10-16 19:15:00 -07:00
John D Pell
7cd02781f8 lib/utilities: _bash-it-component-help()
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.
2021-10-13 21:13:45 -07:00
John D Pell
f7cc442af4 lib/utilities: simplify _bash-it-array-dedup()
alsö fix usage example of `_bash-it-array-contains-element()`
2021-10-13 09:28:21 -07:00
Noah Gorny
48c17e95c3 Merge pull request #1968 from gaelicWizard/oops
theme/powerline: fix an oops in the last patch
2021-10-12 23:26:17 +03:00
John D Pell
953e422bed theme/powerline: fix an oops in the last patch
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.
2021-10-12 11:08:37 -07:00
Ira Abramov
d6239cf190 Merge branch 'master' of https://github.com/bash-it/bash-it into ira/autosave-history-plml
* 'master' of https://github.com/bash-it/bash-it: (114 commits)
  ci: Bump go to 1.17 from 1.14
  skip go tests when go is not available
  plugins: Add ble.sh plugin
  clean up pyenv plugin
  Lint: prepare `lib/utilities` for `shellcheck` (#1933)
  plugin/base: improvements (#1930)
  plugins/percol: `bind`
  completion/git: `shfmt` && `shellcheck`
  completion/git: expand search range
  plugin/percol: `shellcheck` & `shfmt`
  plugins/percol: use `_command_exists`
  completion/pip: simplify code flow
  plugin/less-pretty-cat: remove `|| cat`
  completion/wpscan: simplify code flow (whitespace)
  plugins/less-pretty-cat: simplify code flow
  plugins/less-pretty-cat: use `_command_exists`
  lib/helpers: cite `_bash-it-find-in-ancestor()`
  gradle: adopt `_bash_it_find_in_ancestor()`
  lib/helpers: new function `_bash-it-find-in-ancestor()`
  completion/laravel: simplify code flow
  ...
2021-10-11 08:32:15 +03:00
Noah Gorny
49698e269a Merge pull request #1971 from NoahGorny/ci-update-go-version
ci: Bump go to 1.17 from 1.14
2021-10-10 23:58:08 +03:00
Noah Gorny
adab880f89 ci: Bump go to 1.17 from 1.14 2021-10-10 23:50:39 +03:00
Ira Abramov
c3d333ddc4 fix based on remarks on PR 2021-10-10 15:25:45 +03:00
Noah Gorny
cf08fcaff2 Merge pull request #1965 from gaelicWizard/completion-git
completion/git: improvements and linting
2021-10-07 00:10:47 +03:00
Noah Gorny
c3382c7b50 Merge pull request #1884 from NoahGorny/add-blesh-plugin
plugins: Add ble.sh plugin
2021-10-06 22:49:15 +03:00
cornfeedhobo
07384bcf7c Merge pull request #1967 from cornfeedhobo/goenv-go-tests
skip go tests when go is not available
2021-09-30 07:34:05 -05:00
cornfeedhobo
b7feb14404 skip go tests when go is not available 2021-09-29 18:16:52 -05:00
Noah Gorny
cd38f32d95 test: Fix completion tests and add profile completion ones 2021-09-29 00:30:24 +03:00
Noah Gorny
4c4b138671 tests: Add more bash-it profile tests 2021-09-29 00:30:24 +03:00
Noah Gorny
7fc003b7d6 completion: Add completion for bash-it profile rm/list 2021-09-29 00:30:24 +03:00
Noah Gorny
e1017513d0 helpers: Disallow removing the default profile with bash-it profile rm 2021-09-29 00:30:24 +03:00
Noah Gorny
1ae407150c helpers: Improve bash-it profile messages 2021-09-29 00:30:24 +03:00
Noah Gorny
337e188d25 helpers: Add bash-it profile rm 2021-09-29 00:30:24 +03:00
Noah Gorny
81b17f795b helpers: Add bash-it profile list 2021-09-29 00:30:24 +03:00
Noah Gorny
6a923760d8 helpers: Add help message for bash-it profile 2021-09-29 00:30:24 +03:00
Noah Gorny
c710fc783a gitignore: Ignore new profiles 2021-09-29 00:30:24 +03:00
Noah Gorny
b2ee5f96a5 test: helpers: Add profile command tests 2021-09-29 00:30:24 +03:00
Noah Gorny
d4ec41bef7 helpers: Add useful log in case of empty config 2021-09-29 00:30:24 +03:00
Noah Gorny
df560ca04a docs: Add profile command docs 2021-09-29 00:30:24 +03:00
Noah Gorny
f78139fc05 install: Use new profile load command 2021-09-29 00:30:24 +03:00
Noah Gorny
2e3fe0a1ea install: Load log file 2021-09-29 00:30:24 +03:00
Noah Gorny
cea95d72b3 lib: helpers: Rename _bash-it-process-component to _bash-it-determine-component-status-from-path 2021-09-29 00:30:23 +03:00
Noah Gorny
7f60b73a2a helpers: Add new bash-it profile subcommand 2021-09-29 00:30:23 +03:00
Noah Gorny
956ca517f4 profiles: Add new default profile 2021-09-29 00:30:23 +03:00
Noah Gorny
eaa2f829bd completion: Add bash-it profile subcommand 2021-09-29 00:30:23 +03:00
Noah Gorny
41cba9d7e4 helpers: Add enable-plugin and enable-alias aliases 2021-09-29 00:30:23 +03:00
Noah Gorny
ffeb770593 helpers: Print type when using disable all 2021-09-29 00:30:23 +03:00
Noah Gorny
6e03a726a6 helpers: Split some processing code out of _bash-it-describe 2021-09-29 00:30:23 +03:00
Noah Gorny
7fb7bb9cb8 Merge pull request #1952 from gaelicWizard/uncle
lib/helpers: new function `_bash-it-find-in-ancestor()`
2021-09-28 16:51:30 +03:00
Noah Gorny
008c2b30ac Merge pull request #1885 from cornfeedhobo/pyenv-path
clean up pyenv plugin
2021-09-28 16:49:21 +03:00
Noah Gorny
c360f0c7c5 plugins: Add ble.sh plugin 2021-09-28 16:48:16 +03:00
cornfeedhobo
ec075a404a clean up pyenv plugin
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.
2021-09-28 07:44:40 -05:00
John D Pell
3eed0f033f Lint: prepare lib/utilities for shellcheck (#1933)
* 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}`
2021-09-28 15:24:18 +03:00
Noah Gorny
8a1dc96bc0 Merge pull request #1964 from gaelicWizard/completion-pip
completion/pip: simplify control flow
2021-09-28 15:14:58 +03:00
John D Pell
c2c76a380a plugin/base: improvements (#1930)
* 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. ♥
2021-09-28 15:13:27 +03:00
Noah Gorny
127cbbd4e3 Merge pull request #1957 from gaelicWizard/plugin-less-pretty-cat
plugin/less-pretty-cat improvements
2021-09-28 15:09:28 +03:00
Noah Gorny
05aac8ef39 Merge pull request #1956 from gaelicWizard/plugin-percol
plugin/percol `shellcheck`
2021-09-28 15:06:33 +03:00
Noah Gorny
002a23c758 Merge pull request #1961 from gaelicWizard/completion-wpscan
completion/wpscan: simplify code flow (whitespace)
2021-09-28 15:02:25 +03:00
Noah Gorny
37577550e1 Merge pull request #1963 from gaelicWizard/completion-laravel
completion/laravel: simplify code flow
2021-09-28 14:34:51 +03:00
Noah Gorny
198df8044a Merge pull request #1955 from gaelicWizard/plugin-ruby
plugin/ruby `shellcheck`
2021-09-28 14:16:19 +03:00
John D Pell
a4e4f30ff1 plugins/percol: bind
Move `bind` below function definition
2021-09-26 11:54:32 -07:00
John D Pell
b0750fa49f completion/git: shfmt && shellcheck 2021-09-24 21:11:28 -07:00
John D Pell
e22aac855e completion/git: expand search range
- 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`).
2021-09-24 21:10:01 -07:00
John D Pell
92282c4795 plugin/percol: shellcheck & shfmt
According to `shellcheck`, the `_tac` alias simply doesn't work. At all. Ever. See SC2262 and SC2263.
2021-09-24 00:39:07 -07:00
John D Pell
2ada414266 plugins/percol: use _command_exists
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.
2021-09-24 00:38:54 -07:00
John D Pell
b897c7d3ce completion/pip: simplify code flow
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.
2021-09-23 22:21:02 -07:00
John D Pell
2ddb40751f plugin/less-pretty-cat: remove || cat
The logic to run `cat` if `pygmentize` fails seems useless, so just remove it.
2021-09-23 15:42:23 -07:00
John D Pell
84c96665ce completion/wpscan: simplify code flow (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.
2021-09-23 14:51:21 -07:00
John D Pell
5857648377 plugins/less-pretty-cat: simplify code flow
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.
2021-09-23 10:17:28 -07:00
John D Pell
55be49e887 plugins/less-pretty-cat: use _command_exists
Addresses bash-it/bash-it#1632

Alsö, code style cleanup: quote variables, handle unbound parameters,  &c.
2021-09-23 10:17:28 -07:00
John D Pell
e8966ea2a5 lib/helpers: cite _bash-it-find-in-ancestor()
Add `composure.sh` citation with examples and rewrite internal comments to describe the code flow.
2021-09-23 10:00:52 -07:00
Noah Gorny
d6c4c0cc88 Merge pull request #1960 from gaelicWizard/alias-vim
aliases/vim: simplify code flow
2021-09-23 13:50:57 +03:00
John D Pell
7ed12083f2 gradle: adopt _bash_it_find_in_ancestor() 2021-09-22 15:30:07 -07:00
John D Pell
0471a20c7c lib/helpers: new function _bash-it-find-in-ancestor()
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.
2021-09-22 15:30:07 -07:00
John D Pell
be90e655f1 completion/laravel: simplify code flow
And apply `shfmt` and fix `shellcheck`
2021-09-22 13:48:10 -07:00
John D Pell
e5e7c7c55b plugin/ruby: add missing parameter error message 2021-09-22 13:37:18 -07:00
John D Pell
8a81fd7271 plugins/ruby: prepare for shellcheck 2021-09-22 13:33:34 -07:00
John D Pell
6e2e945771 aliases/vim: simplify code flow 2021-09-22 13:21:16 -07:00
Noah Gorny
8c697715eb Merge pull request #1938 from gaelicWizard/_command_exists
Use `_command_exists` everywhere
2021-09-20 14:56:45 +03:00
Noah Gorny
4700d7bf05 Merge pull request #1935 from gaelicWizard/next
Remove Executable Bit
2021-09-20 14:49:46 +03:00
Noah Gorny
4984d7adc8 Merge pull request #1834 from NoahGorny/lazily-load-pip
completion: pip: Only invoke pip when trying to complete it
2021-09-20 14:47:41 +03:00
John D Pell
fb6e05d915 completions/sqlmap: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
8a03f451b2 lib/helpers: simplify _command_exists() and _binary_exists()
Remove subshell and just use a regular `if`
2021-09-19 21:58:48 -07:00
John D Pell
a2e32f37c5 theme/dulcie: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
eabdf41b83 lib/theme: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
8e9438d715 completion/hub: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
699720fe8b completion/docker-compose: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
679d8b10b6 completion/gradle: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
0ad1af8306 aliases/apt: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
88d66bbfca aliases/curl: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
6618457f9e aliases/general: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
699d893bef completion/awscli: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
dca96e0c39 completion/consul: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
bb555aefbf completion/pew: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
ef0c64322f completion/travis: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
c98424308a plugins/direnv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
b038ea5869 plugins/nodenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
f0179c79ce plugins/plenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
a31145335e plugins/pyenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
cff6f3464a plugins/rbenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
b14bb4735e plugins/ruby: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
ccd8b52e89 plugins/virtualenv: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
c29eb16dfc completion/git_flow: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
5eccc59d27 completion/git_flow_avh: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
757a5bf25b aliases/vim: use _command_exists 2021-09-19 21:58:48 -07:00
John D Pell
cace3a591d main: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
8e169388d2 completions/laravel: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
e2915df1e5 completions/wpscan: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
de58fdd73f plugins/autojump: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
39d6488c6b plugins/base: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
3e2ec1232d plugins/hub: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07:00
John D Pell
635e5488ba plugins/jump: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:58:47 -07:00
John D Pell
e701660ff1 plugins/node: use _command_exists
Addresses bash-it/bash-it#1632

alsö, quote variable, use `[[`, &c.
2021-09-19 21:54:21 -07:00
John D Pell
9378a8318f plugins/nvm: use _command_exists
Addresses bash-it/bash-it#1632

alsö, quote variable, &c.
2021-09-19 21:54:00 -07:00
John D Pell
a7955b972c plugins/powerline: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:53:59 -07:00
John D Pell
f6c5717a7a plugins/textmate: use _command_exists
Addresses bash-it/bash-it#1632
2021-09-19 21:52:46 -07:00
John D Pell
a375e7131e Remove executable bit 2021-09-18 22:26:27 -07:00
Noah Gorny
77e9404c7d Merge pull request #1927 from gaelicWizard/pwd
Use `$PWD` instead of `$(pwd)`
2021-09-19 08:18:54 +03:00
John D Pell
8d1e802565 test: Use ${PWD} instead of $(pwd) 2021-09-18 13:15:13 -07:00
John D Pell
5fc418e479 Use ${PWD} instead of $(pwd)
Don't subshell when there's a shell parameter for it.
2021-09-18 13:15:13 -07:00
John D Pell
1f6d6aa147 Use $PWD instead of \pwd\``
Don't subshell when there's a shell parameter for it.
2021-09-18 13:14:52 -07:00
Noah Gorny
0dbf1d593c Merge pull request #1926 from gaelicWizard/basenamed
Use parameter substitution instead of `dirname`/`basename`, where safe to do so
2021-09-18 18:26:55 +03:00
John D Pell
1c3cbf7ca6 Delete .shellcheckrc (#1947)
* 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
2021-09-18 12:50:59 +03:00
Noah Gorny
b48f3fd7d3 Merge pull request #1909 from gaelicWizard/SVN
themes/base: don't invoke svn if possible
2021-09-18 12:39:48 +03:00
Noah Gorny
b72588edfd Merge pull request #1949 from gaelicWizard/EditorTab
EditorConfig: set `indent_size = tab`
2021-09-18 12:38:42 +03:00
John D Pell
435151819f EditorConfig: set indent_size = tab
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`.
2021-09-17 10:44:53 -07:00
John D Pell
470341b23a Drop basename in favor of Bash strings
Convert `var=$(basename $file)` to `var="${file##*/}"`
2021-09-16 16:59:02 -07:00
John D Pell
dee55a03cc drop dirname in favor of native Bash strings (1 of 2)
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.
2021-09-16 16:59:02 -07:00
Noah Gorny
f9de8d170a Merge pull request #1941 from gaelicWizard/themes_autosave
Themes: use `_save-and-reload-history()`
2021-09-16 21:22:21 +03:00
Noah Gorny
99eab7a76c Merge pull request #1936 from NoahGorny/fix-shellcheck-warnings
plugins: Fix shellcheck warnings on already linted files
2021-09-12 08:13:44 +03:00
John D Pell
9d656747a9 themes: remove executable bit 2021-09-11 21:25:14 -07:00
John D Pell
ffe15ebfe0 themes: use _save-and-reload-history()
First pass to use _Bash It_'s automatic history management.
2021-09-11 21:25:14 -07:00
John D Pell
476fcb4325 lib/theme: new _bash_it_appearance_scm_init()
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.
2021-09-11 10:22:17 -07:00
Noah Gorny
f0690c09fb Merge pull request #1939 from Bash-it/revert-1767-disable-macos-11
Reinstate macOS 11 job
2021-09-11 16:43:36 +03:00
John D Pell
9c1dbbcf12 lib/scmhelpers: reorder SCM detection waterfall
This reduces the need to invoke subprocesses
2021-09-11 00:02:27 -07:00
John D Pell
8c0860588d themes/base: don't invoke svn if possible
If we are specifically in the situation #1612, then check for a working `svn` command. If we're not in that situation, then don't waste time on it.
2021-09-11 00:02:27 -07:00
Noah Gorny
ec3b8d645f Revert "ci: Remove macos-11.0 as it is unreliable" 2021-09-10 16:54:51 +03:00
Noah Gorny
c6f6d8c27a plugins: Fix shellcheck warnings on already linted files 2021-09-09 20:57:03 +03:00
Noah Gorny
9ea60020ae Merge pull request #1915 from gaelicWizard/bash_completion
Support multiple versions of _Bash Completion_
2021-09-07 10:12:12 +03:00
John D Pell
feacd560b6 completion/system: update wording on shell version 2021-09-05 15:43:05 -07:00
John D Pell
ecfcaba32e completion/system: accomodate multiple versions
For Homebrew, switch between v1 and v2 of bash-completion based on whether the running Bash shell is new enough to use v2.
2021-09-05 15:43:05 -07:00
Noah Gorny
5782325dea Merge pull request #1903 from gaelicWizard/unbound
Gracefully handle unbound parameters
2021-08-31 20:16:26 +03:00
John D Pell
85408743fa lib/log: default to no logging at all
Set the default when BASH_IT_LOG_LEVEL is unbound to log level none: no warnings or errors are reported at all.
2021-08-26 14:11:41 -07:00
John D Pell
3654198deb Tests for 'default' prefix 2021-08-26 14:11:41 -07:00
John D Pell
0c412442f5 completion/system: give up hope
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.
2021-08-26 14:11:41 -07:00
John D Pell
cd65e0925f plugins/base: unbound BASH_IT_LEGACY_PASS
Expressly handle as blank when $BASH_IT_LEGACY_PASS is not set.
2021-08-26 14:11:41 -07:00
John D Pell
bd9f4015a7 lib/helpers: handle unset parameter
Expressly handle $BASH_IT_REMOTE as blank when variable is not set.
2021-08-26 14:11:41 -07:00
John D Pell
8fb75cf0e3 lib/helpers: handle unbound parameter
Expressly handle $BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE being not-set as being blank.
2021-08-26 14:11:41 -07:00
John D Pell
0eff44930c lib/utilities: handle unbound parameter
Expressly handle unbound $BASH_IT_GREP when testing for value
2021-08-26 14:11:41 -07:00
John D Pell
233fcc3091 lib/log: handle undefined variable
Expressly deal with if $echo_yellow hasn’t been defined
2021-08-26 14:11:41 -07:00
John D Pell
f71fa5be2c Handle unbound variables
Handle BASH_IT, BASH_IT_OLD_BASH_SETUP, BASH_IT_THEME, BASH_THEME, and PROMPT.
2021-08-26 14:11:41 -07:00
John D Pell
5001995e92 Deal with unabound BASH_IT_RELOAD_LEGACY 2021-08-26 14:11:41 -07:00
John D Pell
bcd67db4ab lib/preview: handle unbound parameter
If $BASH_PREVIEW is unset, treat it as blank.
2021-08-26 14:11:41 -07:00
John D Pell
02c13b7921 lib/log: handle undefined variables
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.
2021-08-26 14:11:41 -07:00
Noah Gorny
8b3867fe35 Merge pull request #1910 from gaelicWizard/brew
lib/helpers: new function to set BASH_IT_HOMEBREW_PREFIX
2021-08-26 22:17:57 +03:00
John D Pell
0f28824ad5 lib/helpers: invert test in _bash_it_homebrew_check()
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.
2021-08-22 12:48:48 -07:00
John D Pell
65ef8e2e8b Use _bash_it_homebrew_check() in plugins, completions
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.
2021-08-22 12:48:48 -07:00
John D Pell
9e255c2139 lib/helpers: new function to set BASH_IT_HOMEBREW_PREFIX
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.
2021-08-22 12:48:48 -07:00
Noah Gorny
226454b069 Merge pull request #1921 from NoahGorny/fix-update-not-popping-back-cwd
fix update not popping back cwd
2021-08-18 21:17:11 +03:00
Noah Gorny
9566a3ec18 helpers: Improve pull_and_update_inner by restoring old pwd
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
2021-08-18 00:29:45 +03:00
Noah Gorny
caec973c18 helpers: Pop pwd correctly when not needing to update 2021-08-17 23:50:58 +03:00
Noah Gorny
9cc36de58e Merge pull request #1918 from NoahGorny/fix-defaults-completion
defaults: Revert to old comparison
2021-08-17 23:36:19 +03:00
Noah Gorny
67eff71d72 defaults: Revert to old comparison
Also fix a small bug along the way :)
2021-08-15 21:28:00 +03:00
Noah Gorny
907fa1de96 Merge pull request #1916 from gaelicWizard/EditorConfig
Don't set `indent_size` when using tabs
2021-08-15 21:04:51 +03:00
John D Pell
6ee4cb4597 EditorConfig: don't specify indent size
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.
2021-08-14 20:14:01 -07:00
John D Pell
de9ea54b81 Don't call external uname when $OSTYPE will do (#1911)
* 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)`
2021-08-14 10:20:12 +03:00
Noah Gorny
e321a3d657 Merge pull request #1913 from Bash-it/ksuther/master
Fixed defaults autocompletion.
2021-08-12 00:35:13 +03:00
Kent Sutherland
a6d58351e7 Fixed defaults autocompletion.
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.
2021-08-12 00:15:18 +03:00
Noah Gorny
0fb9d0c090 Merge pull request #1908 from gaelicWizard/bash_completion
Import bash-completion slightly more carefully
2021-08-12 00:11:47 +03:00
John D Pell
893c8dbb96 completion/system: support $BASH_COMPLETION
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.
2021-08-08 23:08:39 -04:00
John D Pell
43947e2cbc completion/system: prefer direct invocation
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.
2021-08-08 23:08:39 -04:00
Noah Gorny
9ea290a5ed Merge pull request #1852 from tbhaxor/feature/completion/dart
Added completion for dart cli
2021-08-03 23:58:16 +03:00
Noah Gorny
e89403d59b Merge pull request #1881 from NoahGorny/lint-pure-theme
Refactor scm_prompt usage in many themes
2021-08-03 23:22:09 +03:00
Noah Gorny
61c0357414 completion: pip: Only invoke pip when trying to complete it
This should greatly reduce shell load time, as the pip invocation takes
a lot of time
2021-08-03 22:42:01 +03:00
cornfeedhobo
e13f7d1b07 Merge pull request #1901 from cornfeedhobo/libera-chat
move to Libera.Chat
2021-07-11 11:30:21 -05:00
cornfeedhobo
aad58bc910 move to Libera.Chat 2021-07-06 22:21:46 -05:00
Ron Green
d4ebba174c feat(git): add git unpushed alias (#1897)
* feat(git): add git unpushed alias
2021-06-23 15:02:04 +03:00
Zhengnan Zhao
0f3e4dc8be Have git check out main branch if present (#1886)
Create function to get default git branch, and use main branch if present
2021-06-23 13:26:48 +03:00
Gurkirat Singh
e51fe1fe2b Abort upgrade if unsaved changes found in bashit directory (#1890)
helper (improvement): added safeguard for unsaved changes
2021-06-23 13:25:42 +03:00
Noah Gorny
d979c32c8a Merge pull request #1891 from tbhaxor/bugfix/helper/upgrade
Replace reload with restart bash it after upgrade
2021-06-23 13:24:49 +03:00
Noah Gorny
f6e3fc358c Merge pull request #1898 from tbhaxor/bugfix/lint/wpscan
FIxed wpscan completion linting
2021-06-23 13:22:25 +03:00
Noah Gorny
e70211549f Merge pull request #1899 from georgettica/georgettica/bump-pre-commit-hooks
chore(pre-commit): bump version
2021-06-23 13:21:06 +03:00
Ron Green
a3f5b5f29a chore(pre-commit): bump version
done in the beginning because of build issues, but was solved during the work on #1897
2021-06-17 10:37:19 +03:00
Gurkirat Singh
682fd32a13 lint (bugfix): wpscan completion linting fix 2021-06-17 08:51:02 +05:30
Gurkirat Singh
01b916c544 helpers (bugfix): restart bashit after upgrade 2021-06-11 12:41:28 +05:30
ofir shtrull
2444a57cc5 feat: add k8s namespace indicator (#1887)
* Add k8s namespace to prompt
2021-06-10 16:04:56 +03:00
Noah Gorny
9b62a5c4df Merge pull request #1888 from clupasq/feature/powerline-command-duration
Add command duration to the powerline theme family
2021-06-10 16:04:28 +03:00
Cristian Lupascu
1e6113f7b7 Add command duration to the powerline theme family
Fix the __powerline_duration_prompt: location & unused variable `prompt`

Remove the duration segment from powerline* theme defaults

Different color for duration prompt segment
2021-06-05 13:47:54 +03:00
Ira Abramov
9f4c71d40f Add history flushes on each command to the powerline themes. 2021-05-19 10:54:28 +03:00
Noah Gorny
dff892e0a3 themes: Adapt themes to new scm_prompt api 2021-05-16 19:17:02 +03:00
Noah Gorny
2ae0350f5d themes: base: Add unified scm_prompt function 2021-05-16 19:17:02 +03:00
Noah Gorny
b65a7cc67c themes: Lint pure theme 2021-05-16 13:59:18 +03:00
Noah Gorny
7f193a2e05 Add pure theme to clean_files.txt 2021-05-16 13:52:36 +03:00
Noah Gorny
8c47706139 Merge pull request #1877 from NoahGorny/fix-alias-completion-for-real
plugins: Fix alias-completion by comparing completions to alias literally
2021-05-15 18:58:15 +03:00
Noah Gorny
2120be9372 plugins: Fix alias-completion by using helper util
By using _bash-it-array-contains-element, we can safetly iterate over
elements in the $completions array
2021-05-15 11:42:10 +03:00
Noah Gorny
476c568566 Merge pull request #1874 from oliverralbertini/add-hg-bookmarks-support
[base.theme] add support for hg's bookmarks feature
2021-05-08 00:13:20 +03:00
Oliver Ruben Albertini
26118d1835 [base.theme] add support for hg's bookmarks feature
Will conditionally show the branch based on the current bookmark instead
of branch.
2021-04-27 11:36:14 -07:00
Noah Gorny
d3bb347786 Merge pull request #1837 from NoahGorny/vendor-jboss-completion
vendor jboss completion
2021-04-27 01:32:34 +03:00
Noah Gorny
b8da4cb68c Merge pull request #1875 from NoahGorny/fix-alias-completion
plugins: alias-completion: Revert back to read without -r
2021-04-23 17:05:17 +03:00
Noah Gorny
940739a8a0 Merge pull request #1873 from NoahGorny/improve-clean-files-txt
Add clean_files.txt sorting hook
2021-04-23 00:19:05 +03:00
Noah Gorny
716b49fa0e lint: Sort clean_files.txt according to check-clean-files-txt.sh 2021-04-22 20:53:30 +03:00
Noah Gorny
e15b53ea61 hooks: Use compat31 in check-clean-files-txt.sh 2021-04-22 20:53:30 +03:00
Noah Gorny
1b7448bc9d plugins: alias-completion: Revert back to read without -r 2021-04-22 20:38:30 +03:00
Noah Gorny
d0aa9cb542 hooks: Add check-clean-files-txt.sh 2021-04-22 01:48:20 +03:00
Noah Gorny
c731e45770 lint: Make clean_files.txt more tidy 2021-04-22 01:48:13 +03:00
John Fred Fadrigalan
7b8dbd39bc Clean alias completion plugin (#1872)
* Sort plugins/available

* Clean alias-completion plugin

* Fix shellcheck warning. SC1090

* Change shellcheck source to /dev/null for explicity

* Disable shellcheck warning SC2162
2021-04-22 01:46:50 +03:00
Noah Gorny
31bea24da6 Merge pull request #1859 from tbhaxor/feature/completion/dmidecode
Feature/completion/dmidecode
2021-04-22 01:41:56 +03:00
Noah Gorny
7cd94e1f7f Merge pull request #1870 from cevhyruz/clean-candy-theme
Clean candy theme
2021-04-19 21:49:23 +03:00
John Fred Fadrigalan
370c5b349e Sort theme section 2021-04-20 01:48:37 +08:00
John Fred Fadrigalan
c0fa514f7d Place 'theme/clean' alphabetically on clean_files.txt 2021-04-20 01:40:52 +08:00
John Fred Fadrigalan
409e18f7cb Clean candy theme 2021-04-20 01:18:40 +08:00
Noah Gorny
5e723842b8 Merge pull request #1869 from NoahGorny/add-restart-docs
docs: Add a section about bash-it restart
2021-04-14 19:28:12 +03:00
Noah Gorny
7e620fed63 docs: Add a section about bash-it restart 2021-04-14 16:55:23 +03:00
Noah Gorny
58f2240789 Merge pull request #1845 from NoahGorny/docs-add-logo
docs: Add logo of bash-it to readme
2021-04-08 21:48:31 +03:00
Noah Gorny
2201f6658b Add 2021 to license 2021-04-06 20:59:08 +03:00
Noah Gorny
c7f125a85d docs: Improve readme readability 2021-04-06 20:58:26 +03:00
Noah Gorny
80f143c90b docs: Add nice badges to readme 2021-04-06 20:56:31 +03:00
Noah Gorny
5d809dd73d docs: Add logo of bash-it to readme 2021-04-06 20:56:31 +03:00
Gurkirat Singh
e481eb41e5 completion (improvement): dmidecode lint fixed 2021-03-30 11:03:18 +05:30
Gurkirat Singh
a3ae37b385 completion (feature): dmidecode 2021-03-30 11:01:19 +05:30
Gurkirat Singh
ed97b9d51f dart completion (improvement): requested by @NoahGorny 2021-03-26 01:55:37 +05:30
Gurkirat Singh
19db142aae completion (feature): dart cli 2021-03-26 01:43:53 +05:30
Noah Gorny
64d827c3da completion: Use vendored jboss completion
Also include new jboss5 vendored completion
2021-02-13 10:41:16 +02:00
Noah Gorny
a30a76906c Add "jboss-completion" from "https://github.com/rparree/jboss-bash-completion@master"
git-vendor-name: jboss-completion
git-vendor-dir: vendor/github.com/rparree/jboss-bash-completion
git-vendor-repository: https://github.com/rparree/jboss-bash-completion
git-vendor-ref: master
2021-02-13 10:34:49 +02:00
Noah Gorny
e89948a7f0 Squashed 'vendor/github.com/rparree/jboss-bash-completion/' content from commit fc87d94
git-subtree-dir: vendor/github.com/rparree/jboss-bash-completion
git-subtree-split: fc87d94e7da9431133190f60f5a84367e44d650c
2021-02-13 10:34:49 +02:00
252 changed files with 6549 additions and 6618 deletions

10
.editorconfig Executable file → Normal file
View File

@@ -13,11 +13,12 @@ insert_final_newline = true
trim_trailing_whitespace = false trim_trailing_whitespace = false
[.git*] [.git*]
indent_size = tab
indent_style = tab indent_style = tab
[{**.*sh,test/run}] [{**.*sh,test/run,**.bats}]
indent_size = tab
indent_style = tab indent_style = tab
indent_size = 4
shell_variant = bash shell_variant = bash
binary_next_line = true # like -bn binary_next_line = true # like -bn
@@ -28,3 +29,8 @@ end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[**.bats]
indent_size = tab
indent_style = tab
shell_variant = bats

View File

@@ -1,17 +1,13 @@
name: CI name: CI
# Triggers the workflow on push or pull request events # Triggers the workflow on push or pull request events
on: on: [push, pull_request]
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs: jobs:
bats-test: bats-test:
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-10.15] os: [ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -20,6 +16,9 @@ jobs:
- name: Install greadlink - name: Install greadlink
if: startsWith(runner.os, 'macOS') if: startsWith(runner.os, 'macOS')
run: brew install coreutils run: brew install coreutils
- name: Install parallel
if: startsWith(runner.os, 'macOS')
run: brew install parallel
- name: Test code - name: Test code
run: test/run run: test/run
@@ -45,7 +44,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.14 go-version: 1.17
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:

5
.gitignore vendored Executable file → Normal file
View File

@@ -17,3 +17,8 @@ bats
enabled/* enabled/*
/enabled /enabled
tmp/ tmp/
# Do not save profiles
profiles/*
# apart from the default one
!profiles/default.bash_it

View File

@@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending - id: mixed-line-ending
- id: check-added-large-files - id: check-added-large-files
- repo: https://github.com/jumanjihouse/pre-commit-hooks - repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.4 rev: 2.1.5
hooks: hooks:
- id: git-check # Configure in .gitattributes - id: git-check # Configure in .gitattributes
- id: shellcheck - id: shellcheck
@@ -43,3 +43,8 @@ repos:
language: system language: system
files: "\\.bash$" files: "\\.bash$"
types: [file] types: [file]
- id: clean-files-txt
name: Check that clean_files.txt is sorted alphabetically.
entry: ./hooks/check-clean-files-txt.sh
language: system
files: clean_files.txt

View File

@@ -1,6 +0,0 @@
# We use colors and not assigned
disable=SC2154
# Hard to fix
disable=SC2155
# shellcheck is wrong on some
disable=SC2034

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 Bash-it Copyright (c) 2020-2021 Bash-it
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'the silver searcher (ag) aliases' about-alias 'the silver searcher (ag) aliases'
## Summary for args to less: ## Summary for args to less:

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'ansible abbreviations' about-alias 'ansible abbreviations'
alias ans=ansible alias ans=ansible

View File

@@ -1,4 +1,4 @@
#!/bin/bash # shellcheck shell=bash
# #
# -binaryanomaly # -binaryanomaly
@@ -6,9 +6,8 @@ cite 'about-alias'
about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.' about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'
# set apt aliases # set apt aliases
function _set_pkg_aliases() function _set_pkg_aliases() {
{ if _command_exists apt; then
if [ -x $(which apt) ]; then
alias apts='apt-cache search' alias apts='apt-cache search'
alias aptshow='apt-cache show' alias aptshow='apt-cache show'
alias aptinst='sudo apt-get install -V' alias aptinst='sudo apt-get install -V'

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'Atom.io editor abbreviations' about-alias 'Atom.io editor abbreviations'
alias a='atom' alias a='atom'

View File

@@ -1,4 +1,4 @@
cite about-alias # shellcheck shell=bash
about-alias 'Aliases for the bash-it command (these aliases are automatically included with the "general" aliases)' about-alias 'Aliases for the bash-it command (these aliases are automatically included with the "general" aliases)'
# Common misspellings of bash-it # Common misspellings of bash-it

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'puppet bolt aliases' about-alias 'puppet bolt aliases'
# Aliases # Aliases

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'ruby bundler' about-alias 'ruby bundler'
# Bundler Commands # Bundler Commands

View File

@@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite 'about-alias'
about-alias 'xclip shortcuts' about-alias 'xclip shortcuts'
alias pbcopy="xclip -selection clipboard" alias pbcopy="xclip -selection clipboard"

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'common composer abbreviations' about-alias 'common composer abbreviations'
# Aliases # Aliases

View File

@@ -1,12 +1,9 @@
#!/bin/bash # shellcheck shell=bash
cite 'about-alias'
about-alias 'Curl aliases for convenience.' about-alias 'Curl aliases for convenience.'
# set apt aliases # set apt aliases
function _set_pkg_aliases() function _set_pkg_aliases() {
{ if _command_exists curl; then
if [ -x $(which curl) ]; then
# follow redirects # follow redirects
alias cl='curl -L' alias cl='curl -L'
# follow redirects, download as original name # follow redirects, download as original name

View File

@@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite 'about-alias'
about-alias 'dnf aliases for fedora 22+ distros' about-alias 'dnf aliases for fedora 22+ distros'
alias dnfl="dnf list" # List packages alias dnfl="dnf list" # List packages

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'docker-compose abbreviations' about-alias 'docker-compose abbreviations'
alias dco="docker-compose" alias dco="docker-compose"

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'docker abbreviations' about-alias 'docker abbreviations'
alias dk='docker' alias dk='docker'
@@ -11,7 +11,7 @@ alias dki='docker images' # List Docker images
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
case $OSTYPE in case $OSTYPE in
darwin*|*bsd*|*BSD*) darwin* | *bsd* | *BSD*)
alias dkrmui='docker images -q -f dangling=true | xargs docker rmi' # Delete all untagged Docker images alias dkrmui='docker images -q -f dangling=true | xargs docker rmi' # Delete all untagged Docker images
;; ;;
*) *)
@@ -19,8 +19,8 @@ case $OSTYPE in
;; ;;
esac esac
if [ ! -z "$(command ls "${BASH_IT}/enabled/"{[0-9][0-9][0-9]${BASH_IT_LOAD_PRIORITY_SEPARATOR}docker,docker}.plugin.bash 2>/dev/null | head -1)" ]; then if _bash-it-component-item-is-enabled plugin docker; then
# Function aliases from docker plugin: # Function aliases from docker plugin:
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'emacs editor' about-alias 'emacs editor'
case $OSTYPE in case $OSTYPE in

View File

@@ -1,8 +1,8 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'fuck/please to retry last command with sudo' about-alias 'fuck/please to retry last command with sudo'
# Play nicely with 'thefuck' plugin # Play nicely with 'thefuck' plugin
if ! _command_exists fuck ; then if ! _command_exists fuck; then
alias fuck='sudo $(fc -ln -1)' alias fuck='sudo $(fc -ln -1)'
fi fi
alias please=fuck alias please=fuck

View File

@@ -1,12 +1,9 @@
cite about-alias # shellcheck shell=bash
about-alias 'general aliases' about-alias 'general aliases'
if ls --color -d . &> /dev/null if command ls --color -d . &> /dev/null; then
then alias ls='ls --color=auto'
alias ls="ls --color=auto" # BSD `ls` doesn't need an argument (`-G`) when `$CLICOLOR` is set.
elif ls -G -d . &> /dev/null
then
alias ls='ls -G' # Compact view, show colors
fi fi
# List directory contents # List directory contents
@@ -15,36 +12,34 @@ alias la='ls -AF' # Compact view, show hidden
alias ll='ls -al' alias ll='ls -al'
alias l='ls -a' alias l='ls -a'
alias l1='ls -1' alias l1='ls -1'
alias lf='ls -F'
alias _="sudo" alias _='sudo'
# Shortcuts to edit startup files # Shortcuts to edit startup files
alias vbrc="vim ~/.bashrc" alias vbrc='${VISUAL:-vim} ~/.bashrc'
alias vbpf="vim ~/.bash_profile" alias vbpf='${VISUAL:-vim} ~/.bash_profile'
# colored grep # colored grep
# Need to check an existing file for a pattern that will be found to ensure # Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option # that the check works when on an OS that supports the color option
if grep --color=auto "a" "${BASH_IT}/"*.md &> /dev/null if command grep --color=auto "a" "${BASH_IT?}"/*.md &> /dev/null; then
then
alias grep='grep --color=auto' alias grep='grep --color=auto'
fi fi
if which gshuf &> /dev/null if _command_exists gshuf; then
then
alias shuf=gshuf alias shuf=gshuf
fi fi
alias c='clear' alias c='clear'
alias k='clear'
alias cls='clear' alias cls='clear'
alias edit="$EDITOR" alias edit='${EDITOR:-${ALTERNATE_EDITOR?}}'
alias pager="$PAGER" alias pager='${PAGER:=less}'
alias q='exit' alias q='exit'
alias irc="${IRC_CLIENT:=irc}" alias irc='${IRC_CLIENT:=irc}'
# Language aliases # Language aliases
alias rb='ruby' alias rb='ruby'
@@ -65,8 +60,7 @@ alias -- -='cd -' # Go back
alias h='history' alias h='history'
# Tree # Tree
if [ ! -x "$(which tree 2>/dev/null)" ] if ! _command_exists tree; then
then
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
fi fi
@@ -75,16 +69,16 @@ alias md='mkdir -p'
alias rd='rmdir' alias rd='rmdir'
# Shorten extract # Shorten extract
alias xt="extract" alias xt='extract'
# sudo editors # sudo editors
alias svim="sudo vim" alias svim='sudo ${VISUAL:-vim}'
alias snano="sudo nano" alias snano='sudo nano'
# Display whatever file is regular file or folder # Display whatever file is regular file or folder
catt() { function catt() {
for i in "$@"; do for i in "$@"; do
if [ -d "$i" ]; then if [[ -d "$i" ]]; then
ls "$i" ls "$i"
else else
cat "$i" cat "$i"
@@ -98,5 +92,5 @@ catt() {
# aliases and enable just the ones for Bash-it explicitly: # aliases and enable just the ones for Bash-it explicitly:
# bash-it disable alias general # bash-it disable alias general
# bash-it enable alias bash-it # bash-it enable alias bash-it
# shellcheck source=./bash-it.aliases.bash # shellcheck source-path=SCRIPTDIR
source "$BASH_IT/aliases/available/bash-it.aliases.bash" source "$BASH_IT/aliases/available/bash-it.aliases.bash"

View File

@@ -1,5 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
cite 'about-alias'
about-alias 'common git abbreviations' about-alias 'common git abbreviations'
alias g='git' alias g='git'
@@ -37,8 +36,8 @@ alias gcb='git checkout -b'
alias gco='git checkout' alias gco='git checkout'
alias gcob='git checkout -b' alias gcob='git checkout -b'
alias gcobu='git checkout -b ${USER}/' alias gcobu='git checkout -b ${USER}/'
alias gcom='git checkout master' alias gcom='git checkout $(get_default_branch)'
alias gcpd='git checkout master; git pull; git branch -D' alias gcpd='git checkout $(get_default_branch); git pull; git branch -D'
alias gct='git checkout --track' alias gct='git checkout --track'
# clone # clone
@@ -64,13 +63,14 @@ alias gf='git fetch --all --prune'
alias gft='git fetch --all --prune --tags' alias gft='git fetch --all --prune --tags'
alias gftv='git fetch --all --prune --tags --verbose' alias gftv='git fetch --all --prune --tags --verbose'
alias gfv='git fetch --all --prune --verbose' alias gfv='git fetch --all --prune --verbose'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/$(get_default_branch)'
alias gup='git fetch && git rebase' alias gup='git fetch && git rebase'
# log # log
alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative' alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative'
alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\''' alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\'''
alias ggs='gg --stat' alias ggs='gg --stat'
alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' # FROM https://stackoverflow.com/questions/39220870/in-git-list-names-of-branches-with-unpushed-commits
alias gll='git log --graph --pretty=oneline --abbrev-commit' alias gll='git log --graph --pretty=oneline --abbrev-commit'
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/ alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
alias gwc='git whatchanged' alias gwc='git whatchanged'
@@ -104,7 +104,7 @@ alias gp='git push'
alias gpd='git push --delete' alias gpd='git push --delete'
alias gpf='git push --force' alias gpf='git push --force'
alias gpo='git push origin HEAD' alias gpo='git push origin HEAD'
alias gpom='git push origin master' alias gpom='git push origin $(get_default_branch)'
alias gpu='git push --set-upstream' alias gpu='git push --set-upstream'
alias gpunch='git push --force-with-lease' alias gpunch='git push --force-with-lease'
alias gpuo='git push --set-upstream origin' alias gpuo='git push --set-upstream origin'
@@ -112,7 +112,7 @@ alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
# pull # pull
alias gl='git pull' alias gl='git pull'
alias glum='git pull upstream master' alias glum='git pull upstream $(get_default_branch)'
alias gpl='git pull' alias gpl='git pull'
alias gpp='git pull && git push' alias gpp='git pull && git push'
alias gpr='git pull --rebase' alias gpr='git pull --rebase'
@@ -128,9 +128,10 @@ alias grm='git rm'
# rebase # rebase
alias grb='git rebase' alias grb='git rebase'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grm='git rebase master' alias grm='git rebase $(get_default_branch)'
alias grmi='git rebase master -i' alias grmi='git rebase $(get_default_branch) -i'
alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master alias grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
alias gprom='git fetch origin $(get_default_branch) && git rebase origin/$(get_default_branch) && git update-ref refs/heads/$(get_default_branch) origin/$(get_default_branch)' # Rebase with latest remote
# reset # reset
alias gus='git reset HEAD' alias gus='git reset HEAD'
@@ -174,7 +175,7 @@ alias gsu='git submodule update --init --recursive'
# these aliases requires git v2.23+ # these aliases requires git v2.23+
alias gsw='git switch' alias gsw='git switch'
alias gswc='git switch --create' alias gswc='git switch --create'
alias gswm='git switch master' alias gswm='git switch $(get_default_branch)'
alias gswt='git switch --track' alias gswt='git switch --track'
# tag # tag
@@ -196,3 +197,11 @@ esac
function gdv() { function gdv() {
git diff --ignore-all-space "$@" | vim -R - git diff --ignore-all-space "$@" | vim -R -
} }
function get_default_branch() {
if git branch | grep -q '^. main\s*$'; then
echo main
else
echo master
fi
}

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'common git-svn abbreviations' about-alias 'common git-svn abbreviations'
# Aliases # Aliases

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'heroku task abbreviations' about-alias 'heroku task abbreviations'
# heroku # heroku

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'mercurial abbreviations' about-alias 'mercurial abbreviations'
alias hs='hg status' alias hs='hg status'

View File

@@ -1,7 +1,5 @@
# Some aliases for Homebrew Cask # shellcheck shell=bash
about-alias 'Some aliases for Homebrew Cask'
cite 'about-alias'
about-alias 'homebrew-cask abbreviations'
alias bcin='brew cask install' alias bcin='brew cask install'
alias bcrm='brew cask uninstall' alias bcrm='brew cask uninstall'

View File

@@ -1,7 +1,5 @@
# Some aliases for Homebrew # shellcheck shell=bash
about-alias 'Some aliases for Homebrew'
cite 'about-alias'
about-alias 'homebrew abbreviations'
alias bup='brew update && brew upgrade' alias bup='brew update && brew upgrade'
alias bout='brew outdated' alias bout='brew outdated'

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'homesick aliases' about-alias 'homesick aliases'
# Aliases # Aliases
@@ -19,6 +19,5 @@ alias sikpsh="homesick push dotfiles"
alias sikrc="homesick rc dotfiles" alias sikrc="homesick rc dotfiles"
alias sikpth="homesick show_path dotfiles" alias sikpth="homesick show_path dotfiles"
alias sikst="homesick status dotfiles" alias sikst="homesick status dotfiles"
alias siktrk="homesick track $1 dotfiles"
alias sikulnk="homesick unlink dotfiles" alias sikulnk="homesick unlink dotfiles"
alias sikv="homesick version" alias sikv="homesick version"

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'jitsu task abbreviations' about-alias 'jitsu task abbreviations'
# jitsu # jitsu

View File

@@ -1,12 +1,7 @@
#!/bin/bash # shellcheck shell=bash
#
# -binaryanomaly
cite 'about-alias'
about-alias 'kubectl aliases' about-alias 'kubectl aliases'
function _set_pkg_aliases() function _set_pkg_aliases() {
{
if _command_exists kubectl; then if _command_exists kubectl; then
alias kc='kubectl' alias kc='kubectl'
alias kcgp='kubectl get pods' alias kcgp='kubectl get pods'

View File

@@ -1,9 +1,9 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'laravel artisan abbreviations' about-alias 'laravel artisan abbreviations'
# A list of useful laravel aliases # A list of useful laravel aliases
alias laravel="${HOME}/.composer/vendor/bin/laravel" alias laravel='${HOME?}/.composer/vendor/bin/laravel'
# asset # asset
alias a:apub='php artisan asset:publish' alias a:apub='php artisan asset:publish'

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'maven abbreviations' about-alias 'maven abbreviations'
alias mci='mvn clean install' alias mci='mvn clean install'

View File

@@ -1,6 +1,4 @@
#!/bin/bash # shellcheck shell=bash
cite 'about-alias'
about-alias 'MSYS2 aliases' about-alias 'MSYS2 aliases'
LS_COMMON="-hG" LS_COMMON="-hG"
@@ -9,7 +7,8 @@ LS_COMMON="$LS_COMMON -I NTUSER.DAT\* -I ntuser.dat\*"
# alias # alias
# setup the main ls alias if we've established common args # setup the main ls alias if we've established common args
test -n "$LS_COMMON" && alias ls="command ls $LS_COMMON" alias ls='command ls ${LS_COMMON:-}'
alias ll="ls -l" alias ll="ls -l"
alias la="ls -a" alias la="ls -a"
alias lal="ll -a" alias lal="ll -a"
alias lf="ls -F"

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'the Node.js environment aliases' about-alias 'the Node.js environment aliases'
# alias to setup nodejs development environment # alias to setup nodejs development environment

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'common npm abbreviations' about-alias 'common npm abbreviations'
# Aliases # Aliases

View File

@@ -1,26 +1,26 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'osx-specific aliases' about-alias 'osx-specific aliases'
# Desktop Programs # Desktop Programs
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'" alias fireworks='open -a "/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app"'
alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'" alias photoshop='open -a "/Applications/Adobe Photoshop CS3/Adobe Photoshop.app"'
alias preview="open -a '$PREVIEW'" alias preview='open -a "${PREVIEW?}"'
alias xcode="open -a '/Applications/XCode.app'" alias xcode='open -a "/Applications/XCode.app"'
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'" alias filemerge='open -a "/Developer/Applications/Utilities/FileMerge.app"'
alias safari="open -a safari" alias safari='open -a safari'
alias firefox="open -a firefox" alias firefox='open -a firefox'
alias chrome="open -a google\ chrome" alias chrome='open -a "Google Chrome"'
alias chromium="open -a chromium" alias chromium='open -a chromium'
alias dashcode="open -a dashcode" alias dashcode='open -a dashcode'
alias f='open -a Finder ' alias f='open -a Finder '
alias fh='open -a Finder .' alias fh='open -a Finder .'
alias textedit='open -a TextEdit' alias textedit='open -a TextEdit'
alias hex='open -a "Hex Fiend"' alias hex='open -a "Hex Fiend"'
alias skype='open -a Skype' alias skype='open -a Skype'
alias mou='open -a Mou' alias mou='open -a Mou'
alias subl='open -a Sublime\ Text' alias subl='open -a "Sublime Text"'
if [ -s /usr/bin/firefox ] ; then if [[ -s /usr/bin/firefox ]]; then
unalias firefox unalias firefox
fi fi
@@ -37,19 +37,20 @@ alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
alias flush='dscacheutil -flushcache' alias flush='dscacheutil -flushcache'
# Show/hide hidden files (for Mac OS X Mavericks) # Show/hide hidden files (for Mac OS X Mavericks)
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE" alias showhidden='defaults write com.apple.finder AppleShowAllFiles TRUE'
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE" alias hidehidden='defaults write com.apple.finder AppleShowAllFiles FALSE'
# From http://apple.stackexchange.com/questions/110343/copy-last-command-in-terminal # From http://apple.stackexchange.com/questions/110343/copy-last-command-in-terminal
alias copyLastCmd='fc -ln -1 | awk '\''{$1=$1}1'\'' ORS='\'''\'' | pbcopy' # shellcheck disable=SC2142 # The quoting confuses `shellcheck`...
alias copyLastCmd="fc -ln -1 | awk '{\$1=\$1}1' ORS='' | pbcopy"
# Use Finder's Quick Look on a file (^C or space to close) # Use Finder's Quick Look on a file (^C or space to close)
alias ql='qlmanage -p 2>/dev/null' alias ql='qlmanage -p 2>/dev/null'
# Mute/Unmute the system volume. Plays nice with all other volume settings. # Mute/Unmute the system volume. Plays nice with all other volume settings.
alias mute="osascript -e 'set volume output muted true'" alias mute='osascript -e "set volume output muted true"'
alias unmute="osascript -e 'set volume output muted false'" alias unmute='osascript -e "set volume output muted false"'
# Pin to the tail of long commands for an audible alert after long processes # Pin to the tail of long commands for an audible alert after long processes
## curl http://downloads.com/hugefile.zip; lmk ## curl http://downloads.com/hugefile.zip; lmk
alias lmk="say 'Process complete.'" alias lmk='say "Process complete."'

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'phoenix abbreviations' about-alias 'phoenix abbreviations'
# Phoenix Commands # Phoenix Commands

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'puppet aliases' about-alias 'puppet aliases'
# Aliases # Aliases

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'pyrocms abbreviations' about-alias 'pyrocms abbreviations'
### ###

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'rails abbreviations' about-alias 'rails abbreviations'
# Rails Commands # Rails Commands

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'common svn abbreviations' about-alias 'common svn abbreviations'
# Aliases # Aliases

View File

@@ -1,9 +1,9 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'systemd service' about-alias 'systemd service'
case $OSTYPE in case $OSTYPE in
linux*) linux*)
# Improve aliases by bringing the common root `sc|scd` + `sre` for action + `u` for user # Improve aliases by bringing the common root `sc|scd` + `sre` for action + `u` for user
alias sc='systemctl' alias sc='systemctl'
alias scu='systemctl --user' alias scu='systemctl --user'
alias scdr='systemctl daemon-reload' alias scdr='systemctl daemon-reload'
@@ -14,7 +14,7 @@ case $OSTYPE in
alias sceu='systemctl --user stop' alias sceu='systemctl --user stop'
alias scs='systemctl start' alias scs='systemctl start'
alias scsu='systemctl --user start' alias scsu='systemctl --user start'
# Keeping previous aliases for a non-breaking change. # Keeping previous aliases for a non-breaking change.
alias scue='sceu' alias scue='sceu'
alias scus='scsu' alias scus='scsu'
alias scur='scdru' alias scur='scdru'

View File

@@ -1,7 +1,5 @@
# Aliases for Terraform and Terragrunt # shellcheck shell=bash
about-alias 'Aliases for Terraform and Terragrunt'
cite 'about-alias'
about-alias 'Terraform abbreviations'
alias tf='terraform' alias tf='terraform'
alias tfv='terraform validate' alias tfv='terraform validate'

View File

@@ -1,7 +1,5 @@
# Aliases for Terraform and Terragrunt # shellcheck shell=bash
about-alias 'Aliases for Terraform and Terragrunt'
cite 'about-alias'
about-alias 'Terragrunt abbreviations'
alias tg='terragrunt' alias tg='terragrunt'
alias tgv='terragrunt validate' alias tgv='terragrunt validate'

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'textmate abbreviations' about-alias 'textmate abbreviations'
case $OSTYPE in case $OSTYPE in

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'Tmux terminal multiplexer' about-alias 'Tmux terminal multiplexer'
alias txl='tmux ls' alias txl='tmux ls'

View File

@@ -1,8 +1,8 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'todo.txt-cli abbreviations' about-alias 'todo.txt-cli abbreviations'
alias tls="$TODO ls" alias tls='"${TODO?}" ls'
alias ta="$TODO a" alias ta='"${TODO?}" a'
alias trm="$TODO rm" alias trm='"${TODO?}" rm'
alias tdo="$TODO do" alias tdo='"${TODO?}" do'
alias tpri="$TODO pri" alias tpri='"${TODO?}" pri'

View File

@@ -1,4 +1,4 @@
cite 'uuid-alias' # shellcheck shell=bash
about-alias 'uuidgen aliases' about-alias 'uuidgen aliases'
if _command_exists uuid; then # Linux if _command_exists uuid; then # Linux

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'vagrant aliases' about-alias 'vagrant aliases'
# Aliases # Aliases

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'vault aliases' about-alias 'vault aliases'
# Aliases # Aliases

View File

@@ -1,25 +1,14 @@
# shellcheck shell=bash # shellcheck shell=bash
cite 'about-alias'
about-alias 'vim abbreviations' about-alias 'vim abbreviations'
VIM=$(command -v vim) _command_exists vim || return
GVIM=$(command -v gvim)
MVIM=$(command -v mvim)
if [[ -n $VIM ]]; then alias v='vim'
alias v='$VIM' # open the vim help in fullscreen incorporated from
# open the vim help in fullscreen incorporated from # https://stackoverflow.com/a/4687513
# https://stackoverflow.com/a/4687513 alias vimh='vim -c ":h | only"'
alias vimh='${VIM} -c ":h | only"'
fi
# open vim in new tab is taken from # open vim in new tab is taken from
# http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek # http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek
case $OSTYPE in _command_exists mvim && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
darwin*) _command_exists gvim && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
[[ -n $MVIM ]] && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
;;
*)
[[ -n $GVIM ]] && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
;;
esac

View File

@@ -1,4 +1,4 @@
cite 'about-alias' # shellcheck shell=bash
about-alias 'yarn package manager aliases' about-alias 'yarn package manager aliases'
# Aliases # Aliases

View File

@@ -1,159 +1,112 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck source-path=SCRIPTDIR/lib source-path=SCRIPTDIR/scripts
# shellcheck disable=SC2034
#
# Initialize Bash It # Initialize Bash It
BASH_IT_LOG_PREFIX="core: main: " BASH_IT_LOG_PREFIX="core: main: "
: "${BASH_IT:=${BASH_SOURCE%/*}}"
# Only set $BASH_IT if it's not already set : "${BASH_IT_CUSTOM:=${BASH_IT}/custom}"
if [ -z "$BASH_IT" ]; then : "${CUSTOM_THEME_DIR:="${BASH_IT_CUSTOM}/themes"}"
# Setting $BASH to maintain backwards compatibility : "${BASH_IT_BASHRC:=${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}}"
export BASH_IT=$BASH
BASH="$(bash -c 'echo $BASH')"
export BASH
BASH_IT_OLD_BASH_SETUP=true
fi
# Load composure first, so we support function metadata # Load composure first, so we support function metadata
# shellcheck disable=SC1090 # shellcheck source-path=SCRIPTDIR/vendor/github.com/erichs/composure
source "${BASH_IT}"/vendor/github.com/erichs/composure/composure.sh source "${BASH_IT}/vendor/github.com/erichs/composure/composure.sh"
# We need to load logging module first as well in order to be able to log
# shellcheck source=./lib/log.bash
source "${BASH_IT}/lib/log.bash"
# We can only log it now
[ -z "$BASH_IT_OLD_BASH_SETUP" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"
# For backwards compatibility, look in old BASH_THEME location
if [ -z "$BASH_IT_THEME" ]; then
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
export BASH_IT_THEME="$BASH_THEME"
unset BASH_THEME
fi
# support 'plumbing' metadata # support 'plumbing' metadata
cite _about _param _example _group _author _version cite _about _param _example _group _author _version
cite about-alias about-plugin about-completion cite about-alias about-plugin about-completion
# Declare our end-of-main finishing hook, but don't use `declare`/`typeset`
_bash_it_library_finalize_hook=()
# We need to load logging module early in order to be able to log
source "${BASH_IT}/lib/log.bash"
# libraries, but skip appearance (themes) for now # libraries, but skip appearance (themes) for now
_log_debug "Loading libraries(except appearance)..." _log_debug "Loading libraries(except appearance)..."
LIB="${BASH_IT}/lib/*.bash"
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash" APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
for _bash_it_config_file in $LIB; do for _bash_it_main_file_lib in "${BASH_IT}/lib"/*.bash; do
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then [[ "$_bash_it_main_file_lib" == "$APPEARANCE_LIB" ]] && continue
filename=${_bash_it_config_file##*/} _bash-it-log-prefix-by-path "${_bash_it_main_file_lib}"
filename=${filename%.bash}
BASH_IT_LOG_PREFIX="lib: ${filename}: "
_log_debug "Loading library file..." _log_debug "Loading library file..."
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$_bash_it_config_file" source "$_bash_it_main_file_lib"
fi BASH_IT_LOG_PREFIX="core: main: "
done done
# Load vendors # Load the global "enabled" directory, then enabled aliases, completion, plugins
BASH_IT_LOG_PREFIX="vendor: " # "_bash_it_main_file_type" param is empty so that files get sourced in glob order
for _bash_it_vendor_init in "${BASH_IT}"/vendor/init.d/*.bash; do for _bash_it_main_file_type in "" "aliases" "plugins" "completion"; do
_log_debug "Loading \"$(basename "${_bash_it_vendor_init}" .bash)\"..." BASH_IT_LOG_PREFIX="core: reloader: "
# shellcheck disable=SC1090 # shellcheck disable=SC2140
source "${_bash_it_vendor_init}" source "${BASH_IT}/scripts/reloader.bash" ${_bash_it_main_file_type:+"skip" "$_bash_it_main_file_type"}
done BASH_IT_LOG_PREFIX="core: main: "
unset _bash_it_vendor_init
BASH_IT_LOG_PREFIX="core: main: "
# Load the global "enabled" directory
# "family" param is empty so that files get sources in glob order
# shellcheck source=./scripts/reloader.bash
source "${BASH_IT}/scripts/reloader.bash"
# Load enabled aliases, completion, plugins
for file_type in "aliases" "plugins" "completion"; do
# shellcheck source=./scripts/reloader.bash
source "${BASH_IT}/scripts/reloader.bash" "skip" "$file_type"
done done
# Load theme, if a theme was set # Load theme, if a theme was set
if [[ -n "${BASH_IT_THEME}" ]]; then # shellcheck source-path=SCRIPTDIR/themes
_log_debug "Loading \"${BASH_IT_THEME}\" theme..." if [[ -n "${BASH_IT_THEME:-}" ]]; then
# Load colors and helpers first so they can be used in base theme _log_debug "Loading theme '${BASH_IT_THEME}'."
BASH_IT_LOG_PREFIX="themes: colors: "
# shellcheck source=./themes/colors.theme.bash
source "${BASH_IT}/themes/colors.theme.bash"
BASH_IT_LOG_PREFIX="themes: githelpers: " BASH_IT_LOG_PREFIX="themes: githelpers: "
# shellcheck source=./themes/githelpers.theme.bash
source "${BASH_IT}/themes/githelpers.theme.bash" source "${BASH_IT}/themes/githelpers.theme.bash"
BASH_IT_LOG_PREFIX="themes: p4helpers: " BASH_IT_LOG_PREFIX="themes: p4helpers: "
# shellcheck source=./themes/p4helpers.theme.bash
source "${BASH_IT}/themes/p4helpers.theme.bash" source "${BASH_IT}/themes/p4helpers.theme.bash"
BASH_IT_LOG_PREFIX="themes: command_duration: " BASH_IT_LOG_PREFIX="themes: command_duration: "
# shellcheck source=./themes/command_duration.theme.bash
source "${BASH_IT}/themes/command_duration.theme.bash" source "${BASH_IT}/themes/command_duration.theme.bash"
BASH_IT_LOG_PREFIX="themes: base: " BASH_IT_LOG_PREFIX="themes: base: "
# shellcheck source=./themes/base.theme.bash
source "${BASH_IT}/themes/base.theme.bash" source "${BASH_IT}/themes/base.theme.bash"
BASH_IT_LOG_PREFIX="lib: appearance: " BASH_IT_LOG_PREFIX="lib: appearance: "
# appearance (themes) now, after all dependencies # appearance (themes) now, after all dependencies
# shellcheck source=./lib/appearance.bash # shellcheck source=SCRIPTDIR/lib/appearance.bash
source "$APPEARANCE_LIB" source "$APPEARANCE_LIB"
BASH_IT_LOG_PREFIX="core: main: "
fi fi
BASH_IT_LOG_PREFIX="core: main: "
_log_debug "Loading custom aliases, completion, plugins..." _log_debug "Loading custom aliases, completion, plugins..."
for file_type in "aliases" "completion" "plugins"; do for _bash_it_main_file_type in "aliases" "completion" "plugins"; do
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]; then _bash_it_main_file_custom="${BASH_IT}/${_bash_it_main_file_type}/custom.${_bash_it_main_file_type}.bash"
BASH_IT_LOG_PREFIX="${file_type}: custom: " if [[ -s "${_bash_it_main_file_custom}" ]]; then
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
_log_debug "Loading component..." _log_debug "Loading component..."
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${BASH_IT}/${file_type}/custom.${file_type}.bash" source "${_bash_it_main_file_custom}"
fi fi
BASH_IT_LOG_PREFIX="core: main: "
done done
# Custom # Custom
BASH_IT_LOG_PREFIX="core: main: "
_log_debug "Loading general custom files..." _log_debug "Loading general custom files..."
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash" for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/*/*.bash; do
for _bash_it_config_file in $CUSTOM; do if [[ -s "${_bash_it_main_file_custom}" ]]; then
if [ -e "${_bash_it_config_file}" ]; then _bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
filename=$(basename "${_bash_it_config_file}")
filename=${filename%*.bash}
BASH_IT_LOG_PREFIX="custom: $filename: "
_log_debug "Loading custom file..." _log_debug "Loading custom file..."
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$_bash_it_config_file" source "$_bash_it_main_file_custom"
fi fi
BASH_IT_LOG_PREFIX="core: main: "
done done
unset _bash_it_config_file if [[ -n "${PROMPT:-}" ]]; then
if [[ $PROMPT ]]; then PS1="${PROMPT}"
export PS1="\[""$PROMPT""\]"
fi fi
# Adding Support for other OSes # Adding Support for other OSes
PREVIEW="less" if _command_exists gloobus-preview; then
if [ -s /usr/bin/gloobus-preview ]; then
PREVIEW="gloobus-preview" PREVIEW="gloobus-preview"
elif [ -s /Applications/Preview.app ]; then elif [[ -d /Applications/Preview.app ]]; then
# shellcheck disable=SC2034
PREVIEW="/Applications/Preview.app" PREVIEW="/Applications/Preview.app"
fi else
PREVIEW="less"
# Load all the Jekyll stuff
if [ -e "$HOME/.jekyllconfig" ]; then
# shellcheck disable=SC1090
. "$HOME/.jekyllconfig"
fi fi
# BASH_IT_RELOAD_LEGACY is set. # BASH_IT_RELOAD_LEGACY is set.
if ! command -v reload &> /dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then if [[ -n "${BASH_IT_RELOAD_LEGACY:-}" ]] && ! _command_exists reload; then
case $OSTYPE in # shellcheck disable=SC2139
darwin*) alias reload="builtin source '${BASH_IT_BASHRC?}'"
alias reload='source ~/.bash_profile'
;;
*)
alias reload='source ~/.bashrc'
;;
esac
fi fi
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040 for _bash_it_library_finalize_f in "${_bash_it_library_finalize_hook[@]:-}"; do
set +T eval "${_bash_it_library_finalize_f?}" # Use `eval` to achieve the same behavior as `$PROMPT_COMMAND`.
done
unset "${!_bash_it_library_finalize_@}" "${!_bash_it_main_file_@}"

View File

@@ -1,7 +1,7 @@
####################################################################### #######################################################################
# Allow-list of files to be lint-checked by CI # Allow-list of files to be lint-checked by CI
# #
# Directory Suport # Directory Support
# Directory references are allowed within the file, ie: # Directory references are allowed within the file, ie:
# #
# themes/powerline # themes/powerline
@@ -16,75 +16,52 @@
# root directories # root directories
# #
docs aliases/
hooks docs/
hooks/
scripts/
# root files # root files
# #
.gitattributes .gitattributes
lint_clean_files.sh
install.sh
bash_it.sh bash_it.sh
clean_files.txt
# themes install.sh
# lint_clean_files.sh
themes/agnoster
themes/90210
themes/powerline
themes/barbuk
themes/atomic
themes/axin
themes/base.theme.bash
themes/bakke
themes/binaryanomaly
themes/bira
themes/bobby
themes/bobby-python
themes/brainy
themes/brunton
themes/command_duration.theme.bash
themes/easy
themes/modern
themes/purity
# plugins
#
plugins/available/basher.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/docker-machine.plugin.bash
plugins/available/git.plugin.bash
plugins/available/go.plugin.bash
plugins/available/goenv.plugin.bash
plugins/available/history.plugin.bash
plugins/available/history-search.plugin.bash
plugins/available/history-substring-search.plugin.bash
plugins/available/xterm.plugin.bash
# completions # completions
# #
completion/available/apm.completion.bash completion/available/apm.completion.bash
completion/available/awless.completion.bash completion/available/awless.completion.bash
completion/available/bash-it.completion.bash
completion/available/brew.completion.bash completion/available/brew.completion.bash
completion/available/cargo.completion.bash completion/available/cargo.completion.bash
completion/available/composer.completion.bash completion/available/composer.completion.bash
completion/available/conda.completion.bash completion/available/conda.completion.bash
completion/available/consul.completion.bash completion/available/consul.completion.bash
completion/available/dart.completion.bash
completion/available/django.completion.bash completion/available/django.completion.bash
completion/available/docker.completion.bash completion/available/dmidecode.completion.bash
completion/available/docker-machine.completion.bash completion/available/docker-machine.completion.bash
completion/available/docker.completion.bash
completion/available/dotnet.completion.bash
completion/available/gcloud.completion.bash completion/available/gcloud.completion.bash
completion/available/gem.completion.bash completion/available/gem.completion.bash
completion/available/go.completion.bash completion/available/git.completion.bash
completion/available/github-cli.completion.bash completion/available/github-cli.completion.bash
completion/available/go.completion.bash
completion/available/helm.completion.bash completion/available/helm.completion.bash
completion/available/jboss5.completion.bash
completion/available/jboss7.completion.bash
completion/available/jungle.completion.bash completion/available/jungle.completion.bash
completion/available/knife.completion.bash completion/available/knife.completion.bash
completion/available/kontena.completion.bash completion/available/kontena.completion.bash
completion/available/kubectl.completion.bash completion/available/kubectl.completion.bash
completion/available/laravel.completion.bash
completion/available/lerna.completion.bash completion/available/lerna.completion.bash
completion/available/minikube.completion.bash completion/available/minikube.completion.bash
completion/available/notify-send.completion.bash
completion/available/ngrok.completion.bash completion/available/ngrok.completion.bash
completion/available/notify-send.completion.bash
completion/available/npm.completion.bash completion/available/npm.completion.bash
completion/available/packer.completion.bash completion/available/packer.completion.bash
completion/available/pip.completion.bash completion/available/pip.completion.bash
@@ -92,19 +69,102 @@ completion/available/pip3.completion.bash
completion/available/pipenv.completion.bash completion/available/pipenv.completion.bash
completion/available/pipx.completion.bash completion/available/pipx.completion.bash
completion/available/rustup.completion.bash completion/available/rustup.completion.bash
completion/available/vault.completion.bash
completion/available/sdkman.completion.bash completion/available/sdkman.completion.bash
completion/available/system.completion.bash
completion/available/vault.completion.bash
completion/available/vuejs.completion.bash completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash
# aliases # libraries
lib/colors.bash
lib/helpers.bash
lib/history.bash
lib/log.bash
lib/preexec.bash
lib/preview.bash
lib/search.bash
lib/utilities.bash
# plugins
# #
aliases/available/dnf.aliases.bash plugins/available/alias-completion.plugin.bash
aliases/available/vim.aliases.bash plugins/available/autojump.plugin.bash
aliases/available/git.aliases.bash plugins/available/base.plugin.bash
plugins/available/basher.plugin.bash
plugins/available/battery.plugin.bash
plugins/available/blesh.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/colors.plugin.bash
plugins/available/direnv.plugin.bash
plugins/available/dirs.plugin.bash
plugins/available/docker-machine.plugin.bash
plugins/available/gif.plugin.bash
plugins/available/git-subrepo.plugin.bash
plugins/available/git.plugin.bash
plugins/available/go.plugin.bash
plugins/available/goenv.plugin.bash
plugins/available/history-eternal.plugin.bash
plugins/available/history-search.plugin.bash
plugins/available/history-substring-search.plugin.bash
plugins/available/history.plugin.bash
plugins/available/hub.plugin.bash
plugins/available/java.plugin.bash
plugins/available/jekyll.plugin.bash
plugins/available/jump.plugin.bash
plugins/available/latex.plugin.bash
plugins/available/less-pretty-cat.plugin.bash
plugins/available/man.plugin.bash
plugins/available/nginx.plugin.bash
plugins/available/node.plugin.bash
plugins/available/nodenv.plugin.bash
plugins/available/osx-timemachine.plugin.bash
plugins/available/osx.plugin.bash
plugins/available/percol.plugin.bash
plugins/available/plenv.plugin.bash
plugins/available/projects.plugin.bash
plugins/available/proxy.plugin.bash
plugins/available/pyenv.plugin.bash
plugins/available/python.plugin.bash
plugins/available/rbenv.plugin.bash
plugins/available/ruby.plugin.bash
plugins/available/textmate.plugin.bash
plugins/available/todo.plugin.bash
plugins/available/xterm.plugin.bash
plugins/available/zoxide.plugin.bash
# tests # tests
#
test/plugins/alias-completion.plugin.bats
test/run
test/test_helper.bash test/test_helper.bash
test/test_helper_libs.bash
# themes
#
themes/90210
themes/agnoster
themes/atomic
themes/axin
themes/bakke
themes/barbuk
themes/base.theme.bash
themes/binaryanomaly
themes/bira
themes/bobby
themes/bobby-python
themes/brainy
themes/brunton
themes/candy
themes/command_duration.theme.bash
themes/easy
themes/essential
themes/modern
themes/norbu
themes/pete
themes/powerline
themes/pure
themes/purity
# vendor init files # vendor init files
#
vendor/.gitattributes vendor/.gitattributes
vendor/init.d

View File

@@ -0,0 +1,112 @@
# shellcheck shell=bash
about-plugin 'Automatic completion of aliases'
# Load after all aliases and completions to understand what needs to be completed
# BASH_IT_LOAD_PRIORITY: 800
# References:
# http://superuser.com/a/437508/119764
# http://stackoverflow.com/a/1793178/1228454
# Automatically add completion for all aliases to commands having completion functions
function _bash-it-component-completion-callback-on-init-aliases() {
local namespace="alias_completion"
local tmp_file completion_loader alias_name line completions chars
local alias_arg_words new_completion compl_func compl_wrapper alias_defn
# create array of function completion triggers, keeping multi-word triggers together
IFS=$'\n' read -d '' -ra completions < <(complete -p)
((${#completions[@]} == 0)) && return 0
completions=("${completions[@]##complete -* * -}") # strip all but last option plus trigger(s)
completions=("${completions[@]#complete -}") # strip anything missed
completions=("${completions[@]#? * }") # strip last option and arg, leaving only trigger(s)
completions=("${completions[@]#? }") # strip anything missed
#TODO: this will fail on some completions...
# create temporary file for wrapper functions and completions
tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
IFS=$'\n' read -r completion_loader < <(complete -p -D 2> /dev/null)
if [[ "${completion_loader#complete }" =~ '-F'[[:space:]]([[:alnum:]_]+)[[:space:]] ]]; then
completion_loader="${BASH_REMATCH[1]}"
else
completion_loader=""
fi
# read in "<alias> '<aliased command>' '<command args>'" lines from defined aliases
# some aliases do have backslashes that needs to be interpreted
# shellcheck disable=SC2162
while read line; do
line="${line#alias -- }"
line="${line#alias }"
alias_name="${line%%=*}"
alias_defn="${line#*=\'}" # alias definition
alias_defn="${alias_defn%\'}"
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
if [[ ${alias_defn} == ${alias_cmd} ]]; then
alias_args=''
else
alias_args="${alias_defn#*[[:space:]]}" # everything after first word
fi
# skip aliases to pipes, boolean control structures and other command lists
chars='\|\&\;\)\(\n\<\>'
if [[ "${alias_defn}" =~ [$chars] ]]; then
continue
fi
# avoid expanding wildcards
read -ra alias_arg_words <<< "$alias_args"
# skip alias if there is no completion function triggered by the aliased command
if ! _bash-it-array-contains-element "$alias_cmd" "${completions[@]}"; then
if [[ -n "$completion_loader" ]]; then
# force loading of completions for the aliased command
"${completion_loader:?}" "${alias_cmd}"
# 124 means completion loader was successful
[[ $? -eq 124 ]] || continue
completions+=("$alias_cmd")
else
continue
fi
fi
new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
# create a wrapper inserting the alias arguments if any
if [[ -n $alias_args ]]; then
compl_func="${new_completion/#* -F /}"
compl_func="${compl_func%% *}"
# avoid recursive call loops by ignoring our own functions
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then
compl_wrapper="_${namespace}::${alias_name}"
echo "function $compl_wrapper {
local compl_word=\${2?}
local prec_word=\${3?}
# check if prec_word is the alias itself. if so, replace it
# with the last word in the unaliased form, i.e.,
# alias_cmd + ' ' + alias_args.
if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then
prec_word='$alias_cmd $alias_args'
prec_word=\${prec_word#* }
fi
(( COMP_CWORD += ${#alias_arg_words[@]} ))
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[@]}\" \"\${COMP_WORDS[@]:1}\")
(( COMP_POINT -= \${#COMP_LINE} ))
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
(( COMP_POINT += \${#COMP_LINE} ))
\"$compl_func\" \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\"
}" >> "$tmp_file"
new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }"
fi
fi
# replace completion trigger by alias
if [[ -n $new_completion ]]; then
new_completion="${new_completion% *} $alias_name"
echo "$new_completion" >> "$tmp_file"
fi
done < <(alias -p)
# shellcheck source=/dev/null
source "$tmp_file" && command rm -f "$tmp_file"
}
_bash-it-component-completion-callback-on-init-aliases

View File

@@ -1 +1,6 @@
[[ -x "$(which aws_completer)" ]] && complete -C "$(which aws_completer)" aws # shellcheck shell=bash
if _command_exists aws_completer
then
complete -C "$(command -v aws_completer)" aws
fi

View File

@@ -1,140 +1,95 @@
#!/usr/bin/env bash # shellcheck shell=bash
_bash-it-comp-enable-disable() function _compreply_candidates() {
{ local IFS=$'\n'
local enable_disable_args="alias completion plugin"
COMPREPLY=( $(compgen -W "${enable_disable_args}" -- ${cur}) ) read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}")
} }
_bash-it-comp-list-available-not-enabled() function _bash-it() {
{ local cur prev verb file_type candidates suffix
subdirectory="$1"
local available_things
available_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort -d`;
do
file_entity=$(basename $f)
typeset enabled_component=$(command ls "${BASH_IT}/$subdirectory/enabled/"{[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity,$file_entity} 2>/dev/null | head -1)
typeset enabled_component_global=$(command ls "${BASH_IT}/enabled/"[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity 2>/dev/null | head -1)
if [ -z "$enabled_component" ] && [ -z "$enabled_component_global" ]
then
basename $f | sed -e 's/\(.*\)\..*\.bash/\1/g'
fi
done)
COMPREPLY=( $(compgen -W "all ${available_things}" -- ${cur}) )
}
_bash-it-comp-list-enabled()
{
local subdirectory="$1"
local suffix enabled_things
suffix=$(echo "$subdirectory" | sed -e 's/plugins/plugin/g')
enabled_things=$(for f in `sort -d <(compgen -G "${BASH_IT}/$subdirectory/enabled/*.${suffix}.bash") <(compgen -G "${BASH_IT}/enabled/*.${suffix}.bash")`;
do
basename $f | sed -e 's/\(.*\)\..*\.bash/\1/g' | sed -e "s/^[0-9]*---//g"
done)
COMPREPLY=( $(compgen -W "all ${enabled_things}" -- ${cur}) )
}
_bash-it-comp-list-available()
{
subdirectory="$1"
local enabled_things
enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort -d`;
do
basename $f | sed -e 's/\(.*\)\..*\.bash/\1/g'
done)
COMPREPLY=( $(compgen -W "${enabled_things}" -- ${cur}) )
}
_bash-it-comp()
{
local cur prev opts
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD - 1]}"
chose_opt="${COMP_WORDS[1]}" verb="${COMP_WORDS[1]}"
file_type="${COMP_WORDS[2]}" file_type="${COMP_WORDS[2]:-}"
opts="disable enable help migrate reload restart doctor search show update version" candidates=('disable' 'enable' 'help' 'migrate' 'reload' 'restart' 'preview' 'profile' 'doctor' 'search' 'show' 'update' 'version')
case "${chose_opt}" in case "${verb}" in
show) show)
local show_args="aliases completions plugins" candidates=('aliases' 'completions' 'plugins')
COMPREPLY=( $(compgen -W "${show_args}" -- ${cur}) ) _compreply_candidates
return 0
;; ;;
help) help)
if [ x"${prev}" == x"aliases" ]; then if [[ "${prev}" == "aliases" ]]; then
_bash-it-comp-list-available aliases candidates=('all' "$(_bash-it-component-list "${file_type}")")
return 0 _compreply_candidates
else else
local help_args="aliases completions migrate plugins update" candidates=('aliases' 'completions' 'migrate' 'plugins' 'update')
COMPREPLY=( $(compgen -W "${help_args}" -- ${cur}) ) _compreply_candidates
return 0
fi fi
;; ;;
profile)
case "${file_type}" in
load | rm)
if [[ "${file_type}" == "$prev" ]]; then
candidates=("${BASH_IT}/profiles"/*.bash_it)
candidates=("${candidates[@]##*/}")
candidates=("${candidates[@]%%.bash_it}")
_compreply_candidates
fi
;;
save | list) ;;
*)
candidates=('load' 'save' 'list' 'rm')
_compreply_candidates
;;
esac
;;
doctor) doctor)
local doctor_args="errors warnings all" candidates=('errors' 'warnings' 'all')
COMPREPLY=( $(compgen -W "${doctor_args}" -- ${cur}) ) _compreply_candidates
return 0
;; ;;
update) update)
if [[ ${cur} == -* ]];then if [[ "${cur}" == -* ]]; then
local update_args="-s --silent" candidates=('-s' '--silent')
else else
local update_args="stable dev" candidates=('stable' 'dev')
fi fi
COMPREPLY=( $(compgen -W "${update_args}" -- ${cur}) ) _compreply_candidates
return 0
;; ;;
migrate | reload | search | version) migrate | reload | restart | search | version) ;;
preview)
_bash-it-preview # completes itself
return 0 return 0
;; ;;
enable | disable) enable | disable)
if [ x"${chose_opt}" == x"enable" ];then if [[ "${verb}" == "enable" ]]; then
suffix="available-not-enabled" suffix="disabled"
else else
suffix="enabled" suffix="enabled"
fi fi
case "${file_type}" in case "${file_type}" in
alias) alias | completion | plugin)
_bash-it-comp-list-${suffix} aliases candidates=('all' "$("_bash-it-component-list-${suffix}" "${file_type}")")
return 0 _compreply_candidates
;;
plugin)
_bash-it-comp-list-${suffix} plugins
return 0
;;
completion)
_bash-it-comp-list-${suffix} completion
return 0
;; ;;
*) *)
_bash-it-comp-enable-disable candidates=('alias' 'completion' 'plugin')
return 0 _compreply_candidates
;; ;;
esac esac
;; ;;
*)
_compreply_candidates
;;
esac esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
} }
# Activate completion for bash-it and its common misspellings # Activate completion for bash-it and its common misspellings
complete -F _bash-it-comp bash-it complete -F _bash-it bash-it
complete -F _bash-it-comp bash-ti complete -F _bash-it bash-ti
complete -F _bash-it-comp shit complete -F _bash-it shit
complete -F _bash-it-comp bashit complete -F _bash-it bashit
complete -F _bash-it-comp batshit complete -F _bash-it batshit
complete -F _bash-it-comp bash_it complete -F _bash-it bash_it

View File

@@ -5,28 +5,26 @@ about-completion "brew completion"
# Load late to make sure `system` completion loads first # Load late to make sure `system` completion loads first
# BASH_IT_LOAD_PRIORITY: 375 # BASH_IT_LOAD_PRIORITY: 375
if [[ "$(uname -s)" != 'Darwin' ]]; then if [[ "$OSTYPE" != 'darwin'* ]]; then
_log_warning "unsupported operating system - only 'Darwin' is supported" _log_warning "unsupported operating system - only 'Darwin' is supported"
return 0 return 0
fi fi
# Make sure brew is installed # Make sure brew is installed
_command_exists brew || return 0 _bash_it_homebrew_check || return 0
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)} if [[ -r "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" ]]; then
if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]]; then
# shellcheck disable=1090 # shellcheck disable=1090
source "$BREW_PREFIX"/etc/bash_completion.d/brew source "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew"
elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]]; then elif [[ -r "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" ]]; then
# shellcheck disable=1090 # shellcheck disable=1090
source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh source "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh"
elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]]; then elif [[ -f "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" ]]; then
# For the git-clone based installation, see here for more info: # For the git-clone based installation, see here for more info:
# https://github.com/Bash-it/bash-it/issues/1458 # https://github.com/Bash-it/bash-it/issues/1458
# https://docs.brew.sh/Shell-Completion # https://docs.brew.sh/Shell-Completion
# shellcheck disable=1090 # shellcheck disable=1090
source "$BREW_PREFIX"/completions/bash/brew source "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew"
fi fi

View File

@@ -3,14 +3,14 @@ cite "about-completion"
about-completion "composer completion" about-completion "composer completion"
function __composer_completion() { function __composer_completion() {
local cur coms opts com local cur coms opts com words
COMPREPLY=() COMPREPLY=()
_get_comp_words_by_ref -n : cur words _get_comp_words_by_ref -n : cur words
# lookup for command # lookup for command
for word in "${words[@]:1}"; do for word in "${words[@]:1}"; do
if [[ $word != -* ]]; then if [[ "${word}" != -* ]]; then
com=$word com="${word}"
break break
fi fi
done done
@@ -19,7 +19,7 @@ function __composer_completion() {
if [[ ${cur} == --* ]]; then if [[ ${cur} == --* ]]; then
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir" opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
case "$com" in case "${com}" in
about) about)
opts="${opts} " opts="${opts} "
;; ;;
@@ -109,18 +109,18 @@ function __composer_completion() {
# shellcheck disable=SC2207 # shellcheck disable=SC2207
COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
__ltrim_colon_completions "$cur" __ltrim_colon_completions "${cur}"
return 0 return 0
fi fi
# completing for a command # completing for a command
if [[ "$cur" == "$com" ]]; then if [[ "${cur}" == "${com}" ]]; then
coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate" coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate"
# shellcheck disable=SC2207 # shellcheck disable=SC2207
COMPREPLY=($(compgen -W "${coms}" -- "${cur}")) COMPREPLY=($(compgen -W "${coms}" -- "${cur}"))
__ltrim_colon_completions "$cur" __ltrim_colon_completions "${cur}"
return 0 return 0
fi fi

View File

@@ -3,5 +3,5 @@ cite "about-completion"
about-completion "Hashicorp consul completion" about-completion "Hashicorp consul completion"
if _command_exists consul; then if _command_exists consul; then
complete -C "$(which consul)" consul complete -C "$(command -v consul)" consul
fi fi

View File

@@ -0,0 +1,48 @@
# shellcheck shell=bash
__dart_completion() {
# shellcheck disable=SC2155
local prev=$(_get_pword)
# shellcheck disable=SC2155
local curr=$(_get_cword)
local HELP="--help -h"
local VERBOSE="-v --verbose"
case $prev in
analyze)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP --fatal-infos --no-fatal-warnings --fatal-warnings" -- "$curr"))
;;
compile)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP aot-snapshot exe js jit-snapshot kernel" -- "$curr"))
;;
create)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP --template -t --no-pub --pub --force" -- "$curr"))
;;
-t | --template)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "console-simple console-full package-simple web-simple" -- "$curr"))
;;
format)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP $VERBOSE -o --output --fix -l --line-length" -- "$curr"))
;;
pub)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP $VERBOSE --version --no-trace --trace --verbosity cache deps downgrade get global logout outdated publish run upgrade uploader version" -- "$curr"))
;;
run)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP --observe --enable-vm-service --no-pause-isolates-on-exit --no-pause-isolates-on-unhandled-exceptions --no-warn-on-pause-with-no-debugger --pause-isolates-on-exit --pause-isolates-on-unhandled-exceptions --warn-on-pause-with-no-debugger" -- "$curr"))
;;
dart)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$HELP $VERBOSE --version --enable-analytics --disable-analytics help analyze compile create format pub run test" -- "$curr"))
;;
esac
}
complete -F __dart_completion dart

View File

@@ -1,175 +1,5 @@
# defaults # shellcheck shell=bash
# Bash command line completion for defaults
#
# Created by Jonathon Mah on 2006-11-08.
# Copyright 2006 Playhaus. All rights reserved.
#
# Version 1.0 (2006-11-08)
if test -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"; then
_defaults_domains() source "$_"
{ fi
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
local domains=$( defaults domains | sed -e 's/, /:/g' | tr : '\n' | sed -e 's/ /\\ /g' | grep -i "^$cur" )
local IFS=$'\n'
COMPREPLY=( $domains )
if [[ $( echo '-app' | grep "^$cur" ) ]]; then
COMPREPLY[${#COMPREPLY[@]}]="-app"
fi
return 0
}
_defaults()
{
local cur prev host_opts cmds cmd domain keys key_index
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
host_opts='-currentHost -host'
cmds='read read-type write rename delete domains find help'
if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=( $( compgen -W "$host_opts $cmds" -- $cur ) )
return 0
elif [[ $COMP_CWORD -eq 2 ]]; then
if [[ "$prev" == "-currentHost" ]]; then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
elif [[ "$prev" == "-host" ]]; then
return 0
_known_hosts -a
else
_defaults_domains
return 0
fi
elif [[ $COMP_CWORD -eq 3 ]]; then
if [[ ${COMP_WORDS[1]} == "-host" ]]; then
_defaults_domains
return 0
fi
fi
# Both a domain and command have been specified
if [[ ${COMP_WORDS[1]} == [${cmds// /|}] ]]; then
cmd=${COMP_WORDS[1]}
domain=${COMP_WORDS[2]}
key_index=3
if [[ "$domain" == "-app" ]]; then
if [[ $COMP_CWORD -eq 3 ]]; then
# Completing application name. Can't help here, sorry
return 0
fi
domain="-app ${COMP_WORDS[3]}"
key_index=4
fi
elif [[ ${COMP_WORDS[2]} == "-currentHost" ]] && [[ ${COMP_WORDS[2]} == [${cmds// /|}] ]]; then
cmd=${COMP_WORDS[2]}
domain=${COMP_WORDS[3]}
key_index=4
if [[ "$domain" == "-app" ]]; then
if [[ $COMP_CWORD -eq 4 ]]; then
# Completing application name. Can't help here, sorry
return 0
fi
domain="-app ${COMP_WORDS[4]}"
key_index=5
fi
elif [[ ${COMP_WORDS[3]} == "-host" ]] && [[ ${COMP_WORDS[3]} == [${cmds// /|}] ]]; then
cmd=${COMP_WORDS[3]}
domain=${COMP_WORDS[4]}
key_index=5
if [[ "$domain" == "-app" ]]; then
if [[ $COMP_CWORD -eq 5 ]]; then
# Completing application name. Can't help here, sorry
return 0
fi
domain="-app ${COMP_WORDS[5]}"
key_index=6
fi
fi
keys=$( defaults read $domain 2>/dev/null | sed -n -e '/^ [^}) ]/p' | sed -e 's/^ \([^" ]\{1,\}\) = .*$/\1/g' -e 's/^ "\([^"]\{1,\}\)" = .*$/\1/g' | sed -e 's/ /\\ /g' )
case $cmd in
read|read-type)
# Complete key
local IFS=$'\n'
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
;;
write)
if [[ $key_index -eq $COMP_CWORD ]]; then
# Complete key
local IFS=$'\n'
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
elif [[ $((key_index+1)) -eq $COMP_CWORD ]]; then
# Complete value type
# Unfortunately ${COMP_WORDS[key_index]} fails on keys with spaces
local value_types='-string -data -integer -float -boolean -date -array -array-add -dict -dict-add'
local cur_type=$( defaults read-type $domain ${COMP_WORDS[key_index]} 2>/dev/null | sed -e 's/^Type is \(.*\)/-\1/' -e's/dictionary/dict/' | grep "^$cur" )
if [[ $cur_type ]]; then
COMPREPLY=( $cur_type )
else
COMPREPLY=( $( compgen -W "$value_types" -- $cur ) )
fi
elif [[ $((key_index+2)) -eq $COMP_CWORD ]]; then
# Complete value
# Unfortunately ${COMP_WORDS[key_index]} fails on keys with spaces
COMPREPLY=( $( defaults read $domain ${COMP_WORDS[key_index]} 2>/dev/null | grep -i "^${cur//\\/\\\\}" ) )
fi
;;
rename)
if [[ $key_index -eq $COMP_CWORD ]] ||
[[ $((key_index+1)) -eq $COMP_CWORD ]]; then
# Complete source and destination keys
local IFS=$'\n'
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
fi
;;
delete)
if [[ $key_index -eq $COMP_CWORD ]]; then
# Complete key
local IFS=$'\n'
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
fi
;;
esac
return 0
}
complete -F _defaults -o default defaults
# This file is licensed under the BSD license, as follows:
#
# Copyright (c) 2006, Playhaus
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the Playhaus nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# This software is provided by the copyright holders and contributors "as is"
# and any express or implied warranties, including, but not limited to, the
# implied warranties of merchantability and fitness for a particular purpose are
# disclaimed. In no event shall the copyright owner or contributors be liable
# for any direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute goods or
# services; loss of use, data, or profits; or business interruption) however
# caused and on any theory of liability, whether in contract, strict liability,
# or tort (including negligence or otherwise) arising in any way out of the use
# of this software, even if advised of the possibility of such damage.

View File

@@ -0,0 +1,22 @@
# shellcheck shell=bash
function __dmidecode_completion() {
# shellcheck disable=SC2155
local prev=$(_get_pword)
# shellcheck disable=SC2155
local curr=$(_get_cword)
case $prev in
-s | --string | -t | --type)
OPTS=$(dmidecode "$prev" 2>&1 | grep -E '^ ' | sed 's/ *//g')
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$OPTS" -- "$curr"))
;;
dmidecode)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr"))
;;
esac
}
complete -F __dmidecode_completion dmidecode

2
completion/available/docker-compose.completion.bash Normal file → Executable file
View File

@@ -676,7 +676,7 @@ _docker_compose() {
done done
local completions_func=_docker_compose_${command//-/_} local completions_func=_docker_compose_${command//-/_}
declare -F $completions_func >/dev/null && $completions_func _is_function $completions_func && $completions_func
eval "$previous_extglob_setting" eval "$previous_extglob_setting"
return 0 return 0

View File

@@ -0,0 +1,14 @@
# shellcheck shell=bash
about-completion "bash parameter completion for the dotnet CLI"
# see https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
function _dotnet_bash_complete() {
local cur="${COMP_WORDS[COMP_CWORD]}" IFS=$'\n'
local candidates
read -d '' -ra candidates < <(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2> /dev/null)
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur")
}
complete -f -F _dotnet_bash_complete dotnet

View File

@@ -41,8 +41,8 @@ export FAB_COMPLETION_CACHED_TASKS_FILENAME=".fab_tasks~"
# Set command to get time of last file modification as seconds since Epoch # Set command to get time of last file modification as seconds since Epoch
case `uname` in case "$OSTYPE" in
Darwin|FreeBSD) 'darwin'*|'freebsd'*)
__FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'" __FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'"
;; ;;
*) *)

View File

@@ -1,31 +1,35 @@
#!/usr/bin/env bash # shellcheck shell=bash
#
# Only operate on MacOS since there are no linux paths # Locate and load completions for `git`.
if [[ "$(uname -s)" != 'Darwin' ]] ; then
_log_warning "unsupported operating system - only 'Darwin' is supported"
return 0
fi
# Make sure git is installed # Make sure git is installed
_command_exists git || return 0 _command_exists git || return
# Don't handle completion if it's already managed # Don't handle completion if it's already managed
if complete -p git &>/dev/null ; then if complete -p git &> /dev/null; then
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" _log_warning "completion already loaded - this usually means it is safe to stop using this completion"
return 0 return 0
fi fi
_git_bash_completion_found=false _git_bash_completion_xcrun_git=
if _command_exists xcrun; then
_git_bash_completion_xcrun_git="$(xcrun --find git)"
fi
_git_bash_completion_paths=( _git_bash_completion_paths=(
# Standard locations
"${GIT_EXE%/*}/../share/git-core/git-completion.bash"
"${GIT_EXE%/*}/../share/git-core/contrib/completion/git-completion.bash"
"${GIT_EXE%/*}/../etc/bash_completion.d/git-completion.bash"
# MacOS non-system locations # MacOS non-system locations
'/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash' "${_git_bash_completion_xcrun_git%/bin/git}/share/git-core/git-completion.bash"
'/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash'
) )
# Load the first completion file found # Load the first completion file found
for _comp_path in "${_git_bash_completion_paths[@]}" ; do _git_bash_completion_found=false
if [ -r "$_comp_path" ] ; then for _comp_path in "${_git_bash_completion_paths[@]}"; do
if [[ -r "$_comp_path" ]]; then
_git_bash_completion_found=true _git_bash_completion_found=true
# shellcheck disable=SC1090 # don't follow
source "$_comp_path" source "$_comp_path"
break break
fi fi
@@ -35,5 +39,4 @@ done
if [[ "${_git_bash_completion_found}" == false ]]; then if [[ "${_git_bash_completion_found}" == false ]]; then
_log_warning "no completion files found - please try enabling the 'system' completion instead." _log_warning "no completion files found - please try enabling the 'system' completion instead."
fi fi
unset _git_bash_completion_paths unset "${!_git_bash_completion@}"
unset _git_bash_completion_found

View File

@@ -172,6 +172,7 @@ __git_flow_list_hotfixes ()
} }
# temporarily wrap __git_find_on_cmdline() for backwards compatibility # temporarily wrap __git_find_on_cmdline() for backwards compatibility
if [ -z "`type -t __git_find_subcommand`" ]; then if ! _command_exists __git_find_subcommand
then
alias __git_find_subcommand=__git_find_on_cmdline alias __git_find_subcommand=__git_find_on_cmdline
fi fi

View File

@@ -505,6 +505,7 @@ __git_flow_list_branches ()
} }
# alias __git_find_on_cmdline for backwards compatibility # alias __git_find_on_cmdline for backwards compatibility
if [ -z "`type -t __git_find_on_cmdline`" ]; then if ! _command_exists __git_find_on_cmdline
then
alias __git_find_on_cmdline=__git_find_subcommand alias __git_find_on_cmdline=__git_find_subcommand
fi fi

View File

@@ -22,17 +22,9 @@
# Avoid inaccurate completions for subproject tasks # Avoid inaccurate completions for subproject tasks
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g') COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
__gradle-set-project-root-dir() { function __gradle-set-project-root-dir() {
local dir=`pwd` project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")"
project_root_dir=`pwd` return "$?"
while [[ $dir != '/' ]]; do
if [[ -f "$dir/settings.gradle" || -f "$dir/gradlew" ]]; then
project_root_dir=$dir
return 0
fi
dir="$(dirname "$dir")"
done
return 1
} }
__gradle-init-cache-dir() { __gradle-init-cache-dir() {
@@ -58,9 +50,9 @@ __gradle-set-cache-name() {
__gradle-set-files-checksum() { __gradle-set-files-checksum() {
# Cache MD5 sum of all Gradle scripts and modified timestamps # Cache MD5 sum of all Gradle scripts and modified timestamps
if builtin command -v md5 > /dev/null; then if _command_exists md5; then
gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)") gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)")
elif builtin command -v md5sum > /dev/null; then elif _command_exists md5sum; then
gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}') gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}')
else else
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH" echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"

View File

@@ -23,12 +23,12 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# If there is no git tab completion, but we have the _completion loader try to load it # If there is no git tab completion, but we have the _completion loader try to load it
if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then if ! _is_function _git && _is_function _completion_loader; then
_completion_loader git _completion_loader git
fi fi
# Check that git tab completion is available and we haven't already set up completion # Check that git tab completion is available and we haven't already set up completion
if declare -F _git > /dev/null && ! declare -F __git_list_all_commands_without_hub > /dev/null; then if _is_function _git && ! _is_function __git_list_all_commands_without_hub; then
# Duplicate and rename the 'list_all_commands' function # Duplicate and rename the 'list_all_commands' function
eval "$(declare -f __git_list_all_commands | \ eval "$(declare -f __git_list_all_commands | \
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
@@ -227,7 +227,7 @@ EOF
((c++)) ((c++))
done done
if [ -z "$name" ]; then if [ -z "$name" ]; then
repo=$(basename "$(pwd)") repo="$(basename "${PWD}")"
fi fi
case "$prev" in case "$prev" in
-d|-h) -d|-h)

View File

@@ -0,0 +1,4 @@
# shellcheck shell=bash
about-completion "jboss5 completion"
# shellcheck disable=SC1090
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss5

View File

@@ -1,160 +1,4 @@
# Completions for JBoss Application Server 7 (EAP 6) # shellcheck shell=bash
# VERSION: 0.6 about-completion "jboss7 completion"
# DATE: 2012-10-30 # shellcheck disable=SC1090
# rparree-at-edc4it-dot-com source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss7
# MIT License
# Copyright (c) 2020 Raphael Parree
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
_serverProfiles(){
if [[ $COMP_WORDS == *standalone.sh* ]]
then
serverdir="../standalone/configuration/"
else
# assume is domain.sh
serverdir="../domain/configuration/"
fi
for i in ${!COMP_WORDS[*]}
do
if [[ "${COMP_WORDS[i]}" == "-Djboss.server.base.dir" || "${COMP_WORDS[i]}" == "-Djboss.domain.base.dir" ]]; then
serverdir="${COMP_WORDS[i+2]}/configuration"
fi
done
if [ -d "${serverdir}" ]
then
IFS=$'\n' tmp="$(ls "${serverdir}" | grep xml)"
local fls="${tmp[@]// /\ }"
unset IFS
COMPREPLY=( $(compgen -W "${fls} initial boot last v" -- "$cur" ))
fi
}
_bindingAddress(){
# from /etc/bash_completion.d/ssh
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"0.0.0.0 $( PATH="$PATH:/sbin" ifconfig -a | \
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
-- "$cur" ) )
}
_jboss(){
local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
case $cur in
-Djboss.socket.binding.port-offset=*)
cur=${cur#*=}
#static list of common bindings sets
local bindings="100 200 300 400 10000 20000 30000 40000"
COMPREPLY=( $(compgen -W "${bindings}" -- ${cur}) )
return 0
;;
-Djboss.default.jgroups.stack=*)
cur=${cur#*=}
#static list of standard JGroups stacks
local stacks="udp udp-async udp-sync tcp tcp-sync"
COMPREPLY=( $(compgen -W "${stacks}" -- ${cur}) )
return 0
;;
-Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef=*|-Dcom.sun.management.jmxremote.authenticate=*|-Dcom.sun.management.jmxremote.ssl=*)
cur=${cur#*=}
local booleans="true false"
COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) )
return 0
;;
-Djboss.server.base.dir=*|-Djboss.home.dir=*|-Djboss.domain.base.dir=*)
cur=${cur#*=}
_filedir -d
return 0
;;
-Djboss.domain.master.address=*|-Djboss.bind.address*=*)
cur=${cur#*=}
_bindingAddress
return 0
;;
--server-config=*|-c=|--host-config=*)
cur=${cur#*=}
_serverProfiles
return 0
esac
case $prev in
-u)
# a few from RFC 2365 IPv4 Local Scope ()
local addresses="239.255.0.1 239.255.0.2 239.255.0.3"
COMPREPLY=( $(compgen -W "${addresses}" -- ${cur}) )
return 0
;;
-b*)
_bindingAddress
return 0
;;
-c)
_serverProfiles
return 0
;;
*)
;;
esac
# *** from jboss5 ********************
# *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory
# *** -Djboss.Domain -Djboss.modcluster.proxyList -Djboss.jvmRoute -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl
# *************************************
# standard commands for standalone and domain mode
local commandsWithoutEqualSign='-b -bmanagement -bunsecure -bpublic --admin-only -h -help -u -version -V -v'
local commandsWithEqualSign='-P -Djboss.node.name -Djboss.home.dir -Djboss.socket.binding.port-offset -Djboss.bind.address.management -Djboss.bind.address -Djboss.bind.address.unsecure'
if [[ $COMP_WORDS == *standalone.sh* ]]
then
commandsWithoutEqualSign="${commandsWithoutEqualSign} -c"
commandsWithEqualSign="${commandsWithEqualSign} --server-config -Djboss.server.base.dir -c"
else
# assume is domain.sh
commandsWithoutEqualSign="${commandsWithoutEqualSign} --backup --cached-dc"
commandsWithEqualSign="${commandsWithEqualSign} -Djboss.domain.master.address --host-config -Djboss.domain.master.port -Djboss.domain.base.dir "
fi
COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" )
$( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) )
return 0
}
complete -o nospace -F _jboss standalone.sh
complete -o nospace -F _jboss domain.sh

View File

@@ -42,6 +42,7 @@ _KAC_is_file_newer_than() {
_KAC_regen_cache() { _KAC_regen_cache() {
local CACHE_NAME=$1 local CACHE_NAME=$1
local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
# shellcheck disable=SC2155
local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX") local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX")
shift 1 shift 1
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
@@ -54,18 +55,19 @@ _KAC_regen_cache() {
# cached files can't have spaces in their names # cached files can't have spaces in their names
_KAC_get_cache_name_from_command() { _KAC_get_cache_name_from_command() {
echo "${@/ /_SPACE_}" echo "${@// /_SPACE_}"
} }
# the reverse operation from the function above # the reverse operation from the function above
_KAC_get_command_from_cache_name() { _KAC_get_command_from_cache_name() {
echo "${@/_SPACE_/ }" echo "${@//_SPACE_/ }"
} }
# given a command as argument, it fetches the cache for that command if it can find it # given a command as argument, it fetches the cache for that command if it can find it
# otherwise it waits for the cache to be generated # otherwise it waits for the cache to be generated
# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable # in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable
# for obvious reason, do NOT call that in a sub-shell (in particular, no piping) # for obvious reason, do NOT call that in a sub-shell (in particular, no piping)
# shellcheck disable=SC2155
_KAC_get_and_regen_cache() { _KAC_get_and_regen_cache() {
# the cache name can't have space in it # the cache name can't have space in it
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@") local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
@@ -100,7 +102,7 @@ _KAC_clean_cache() {
# perform a cache cleaning when loading this file # perform a cache cleaning when loading this file
# On big systems this could baloon up to a 30 second run or more, so not enabling by default. # On big systems this could baloon up to a 30 second run or more, so not enabling by default.
[[ "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache [[ -n "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache
##################################### #####################################
### End of cache helper functions ### ### End of cache helper functions ###
@@ -118,7 +120,7 @@ _KAC_get_current_base_command() {
local PREVIOUS="knife" local PREVIOUS="knife"
local I=1 local I=1
local CURRENT local CURRENT
while [ $I -le "$COMP_CWORD" ]; do while [[ "${I}" -le "${COMP_CWORD}" ]]; do
# command words are all lower-case # command words are all lower-case
echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break
CURRENT="$PREVIOUS ${COMP_WORDS[$I]}" CURRENT="$PREVIOUS ${COMP_WORDS[$I]}"
@@ -127,12 +129,13 @@ _KAC_get_current_base_command() {
I=$((I + 1)) I=$((I + 1))
done done
_KAC_CURRENT_COMMAND=$PREVIOUS _KAC_CURRENT_COMMAND=$PREVIOUS
[ $I -le "$COMP_CWORD" ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I [[ "${I}" -le "${COMP_CWORD}" ]] && _KAC_CURRENT_COMMAND_NB_WORDS="${I}"
} }
# searches the position of the currently completed argument in the current base command # searches the position of the currently completed argument in the current base command
# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...) # (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...)
# assumes the current base command is complete # assumes the current base command is complete
# shellcheck disable=SC2155
_KAC_get_current_arg_position() { _KAC_get_current_arg_position() {
local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1)) local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1))
local COMPLETE_COMMAND=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH") local COMPLETE_COMMAND=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH")
@@ -150,10 +153,11 @@ _KAC_get_current_arg_position() {
_knife() { _knife() {
_KAC_get_and_regen_cache _KAC_knife_commands _KAC_get_and_regen_cache _KAC_knife_commands
local RAW_LIST ITEM REGEN_CMD ARG_POSITION local RAW_LIST ITEM REGEN_CMD ARG_POSITION
# shellcheck disable=SC2034
COMREPLY=() COMREPLY=()
# get correct command & arg pos # get correct command & arg pos
_KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$((COMP_CWORD + 1)) _KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$((COMP_CWORD + 1))
RAW_LIST=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH" | cut -d ' ' -f $ARG_POSITION | uniq) RAW_LIST=$(grep -E "^${_KAC_CURRENT_COMMAND}" "${_KAC_CACHE_PATH}" | cut -d ' ' -f "${ARG_POSITION}" | uniq)
# we need to process that raw list a bit, most notably for placeholders # we need to process that raw list a bit, most notably for placeholders
# NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc) # NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc)

View File

@@ -1,15 +1,16 @@
#!/usr/bin/bash # shellcheck shell=bash
if command -v laravel > /dev/null; then _command_exists laravel || return
__laravel_completion() {
local OPTS=("-h --help -q --quiet --ansi --no-ansi -n --no-interaction -v -vv -vvv --verbose help list new") function __laravel_completion() {
local OPTS=('-h' '--help' '-q' '--quiet' '--ansi' '--no-ansi' '-n' '--no-interaction' '-v' '-vv' '-vvv' '--verbose' 'help' 'list' 'new')
local _opt_
COMPREPLY=() COMPREPLY=()
for _opt_ in ${OPTS[@]}; do for _opt_ in "${OPTS[@]}"; do
if [[ "$_opt_" == "$2"* ]]; then if [[ "$_opt_" == "$2"* ]]; then
COMPREPLY+=("$_opt_") COMPREPLY+=("$_opt_")
fi fi
done done
} }
complete -F __laravel_completion laravel complete -F __laravel_completion laravel
fi

View File

@@ -1,7 +1,9 @@
# shellcheck shell=bash # shellcheck shell=bash
__ngrok_completion() { __ngrok_completion() {
# shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
# shellcheck disable=SC2155
local curr=$(_get_cword) local curr=$(_get_cword)
local BASE_NO_CONF="--log --log-format --log-level --help" local BASE_NO_CONF="--log --log-format --log-level --help"

View File

@@ -1,7 +1,9 @@
# shellcheck shell=bash # shellcheck shell=bash
function __notify-send_completions() { function __notify-send_completions() {
# shellcheck disable=SC2155
local curr=$(_get_cword) local curr=$(_get_cword)
# shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
case $prev in case $prev in

View File

@@ -1 +1,6 @@
[[ -x "$(which pew)" ]] && source "$(pew shell_config)" # shellcheck shell=bash
if _command_exists pew
then
source "$(pew shell_config)"
fi

View File

@@ -6,6 +6,15 @@
# If the pip package is installed within virtual environments, say, python managed by pyenv, # If the pip package is installed within virtual environments, say, python managed by pyenv,
# you should first initialize the corresponding environment. # you should first initialize the corresponding environment.
# So that pip is in the system's path. # So that pip is in the system's path.
if _command_exists pip; then _command_exists pip || return
function __bash_it_complete_pip() {
if _command_exists _pip_completion; then
complete -o default -F _pip_completion pip
_pip_completion "$@"
else
eval "$(pip completion --bash)" eval "$(pip completion --bash)"
fi _pip_completion "$@"
fi
}
complete -o default -F __bash_it_complete_pip pip

View File

@@ -6,6 +6,15 @@
# If the pip package is installed within virtual environments, say, python managed by pyenv, # If the pip package is installed within virtual environments, say, python managed by pyenv,
# you should first initialize the corresponding environment. # you should first initialize the corresponding environment.
# So that pip3 is in the system's path. # So that pip3 is in the system's path.
if _command_exists pip3; then _command_exists pip3 || return
function __bash_it_complete_pip3() {
if _command_exists _pip_completion; then
complete -o default -F _pip_completion pip3
_pip_completion "$@"
else
eval "$(pip3 completion --bash)" eval "$(pip3 completion --bash)"
fi _pip_completion "$@"
fi
}
complete -o default -F __bash_it_complete_pip3 pip3

View File

@@ -1,4 +1,4 @@
# shellcheck shell=bash # shellcheck shell=bash
if _command_exists pipenv; then if _command_exists pipenv; then
eval "$(pipenv --completion)" eval "$(_PIPENV_COMPLETE=bash_source pipenv)"
fi fi

View File

@@ -1,7 +1,9 @@
# shellcheck shell=bash # shellcheck shell=bash
_sdkman_complete() {
function _sdkman_complete() {
local CANDIDATES local CANDIDATES
local CANDIDATE_VERSIONS local CANDIDATE_VERSIONS
local SDKMAN_CANDIDATES_CSV="${SDKMAN_CANDIDATES_CSV:-}"
COMPREPLY=() COMPREPLY=()
@@ -10,7 +12,7 @@ _sdkman_complete() {
elif [ "$COMP_CWORD" -eq 2 ]; then elif [ "$COMP_CWORD" -eq 2 ]; then
case "${COMP_WORDS[COMP_CWORD - 1]}" in case "${COMP_WORDS[COMP_CWORD - 1]}" in
"install" | "i" | "uninstall" | "rm" | "list" | "ls" | "use" | "u" | "default" | "d" | "home" | "h" | "current" | "c" | "upgrade" | "ug") "install" | "i" | "uninstall" | "rm" | "list" | "ls" | "use" | "u" | "default" | "d" | "home" | "h" | "current" | "c" | "upgrade" | "ug")
CANDIDATES=$(echo "${SDKMAN_CANDIDATES_CSV}" | tr ',' ' ') CANDIDATES="${SDKMAN_CANDIDATES_CSV//,/${IFS:0:1}}"
mapfile -t COMPREPLY < <(compgen -W "$CANDIDATES" -- "${COMP_WORDS[COMP_CWORD]}") mapfile -t COMPREPLY < <(compgen -W "$CANDIDATES" -- "${COMP_WORDS[COMP_CWORD]}")
;; ;;
"env") "env")
@@ -46,17 +48,17 @@ _sdkman_complete() {
return 0 return 0
} }
_sdkman_candidate_local_versions() { function _sdkman_candidate_local_versions() {
CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "$1") CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "$1")
} }
_sdkman_candidate_all_versions() { function _sdkman_candidate_all_versions() {
candidate="$1" candidate="$1"
CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate") CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate")
if [ "$SDKMAN_OFFLINE_MODE" = "true" ]; then if [[ "${SDKMAN_OFFLINE_MODE:-false}" == "true" ]]; then
CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS
else else
# sdkman has a specific output format for Java candidate since # sdkman has a specific output format for Java candidate since
@@ -70,12 +72,12 @@ _sdkman_candidate_all_versions() {
# "+" - local version # "+" - local version
# "*" - installed # "*" - installed
# ">" - currently in use # ">" - currently in use
CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort | uniq -u) " CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort -u) "
fi fi
} }
__sdkman_cleanup_local_versions() { function __sdkman_cleanup_local_versions() {
__sdkman_build_version_csv "$1" | tr ',' ' ' __sdkman_build_version_csv "$1" | tr ',' ' '

View File

@@ -1,4 +1,4 @@
#!/bin/bash # shellcheck shell=bash
# ---------------------------------------------------------------------------+ # ---------------------------------------------------------------------------+
# | # |
@@ -7,15 +7,16 @@
# | # |
# ---------------------------------------------------------------------------+ # ---------------------------------------------------------------------------+
if command -v sqlmap > /dev/null; then if _command_exists sqlmap
then
_sqlmap() function _sqlmap()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=$(_get_cword) cur="$(_get_cword)"
prev=$(_get_pword) prev="$(_get_pword)"
case $prev in case $prev in

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,52 @@
#!/usr/bin/env bash # shellcheck shell=bash
#
# Loads the system's Bash completion modules. # Loads the system's Bash completion modules.
# If Homebrew is installed (OS X), it's Bash completion modules are loaded. # If Homebrew is installed (OS X), it's Bash completion modules are loaded.
if [[ -r /etc/bash_completion ]] ; then # Load before other completions
# shellcheck disable=SC1091 # BASH_IT_LOAD_PRIORITY: 325
# Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase.
if shopt -qo nounset; then
__bash_it_restore_nounset=true
shopt -uo nounset
else
__bash_it_restore_nounset=false
fi
# shellcheck disable=SC1090 disable=SC1091
if [[ -r "${BASH_COMPLETION:-}" ]]; then
source "${BASH_COMPLETION}"
elif [[ -r /etc/bash_completion ]]; then
source /etc/bash_completion source /etc/bash_completion
# Some distribution makes use of a profile.d script to import completion. # Some distribution makes use of a profile.d script to import completion.
elif [[ -r /etc/profile.d/bash_completion.sh ]] ; then elif [[ -r /etc/profile.d/bash_completion.sh ]]; then
# shellcheck disable=SC1091
source /etc/profile.d/bash_completion.sh source /etc/profile.d/bash_completion.sh
elif _bash_it_homebrew_check; then
fi : "${BASH_COMPLETION_COMPAT_DIR:=${BASH_IT_HOMEBREW_PREFIX}/etc/bash_completion.d}"
case "${BASH_VERSION}" in
if [[ "$(uname -s)" == 'Darwin' ]] && _command_exists brew ; then 1* | 2* | 3.0* | 3.1*)
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)} _log_warning "Cannot load completion due to version of shell. Are you using Bash 3.2+?"
;;
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path 3.2* | 4.0* | 4.1*)
if [[ -r "$BREW_PREFIX"/etc/profile.d/bash_completion.sh ]] ; then # Import version 1.x of bash-completion, if installed.
# shellcheck disable=SC1090 BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion"
source "$BREW_PREFIX"/etc/profile.d/bash_completion.sh if [[ -r "$BASH_COMPLETION" ]]; then
source "$BASH_COMPLETION"
else
unset BASH_COMPLETION
fi fi
;;
4.2* | 5* | *)
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
if [[ -r "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh" ]]; then
source "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh"
fi
;;
esac
fi fi
if [[ ${__bash_it_restore_nounset:-false} == "true" ]]; then
shopt -so nounset
fi
unset __bash_it_restore_nounset

View File

@@ -1,5 +1,10 @@
if [[ -x "$(which travis)" ]]; then # shellcheck shell=bash
__TRAVIS_COMPLETION_SCRIPT="${TRAVIS_CONFIG_PATH:-${HOME}/.travis}/travis.sh"
[[ -f "${__TRAVIS_COMPLETION_SCRIPT}" ]] && source "${__TRAVIS_COMPLETION_SCRIPT}" if _command_exists travis
then
if [[ -s "${__TRAVIS_COMPLETION_SCRIPT:=${TRAVIS_CONFIG_PATH:-${HOME}/.travis}/travis.sh}" ]]
then
source "${__TRAVIS_COMPLETION_SCRIPT}"
fi
unset __TRAVIS_COMPLETION_SCRIPT unset __TRAVIS_COMPLETION_SCRIPT
fi fi

View File

@@ -1,7 +1,9 @@
# shellcheck shell=bash # shellcheck shell=bash
__vuejs_completion() { __vuejs_completion() {
# shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
# shellcheck disable=SC2155
local curr=$(_get_cword) local curr=$(_get_cword)
case $prev in case $prev in

View File

@@ -1,15 +1,16 @@
#!/usr/bin/bash # shellcheck shell=bash
if command -v wpscan > /dev/null; then _command_exists wpscan || return
__wpscan_completion() {
local OPTS=("--help --hh --version --url --ignore-main-redirect --verbose --output --format --detection-mode --scope --headers --user-agent --vhost --random-user-agent --user-agents-list --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tlc-checks --proxy --proxy-auth --cookie-string --cookie-jar --cache-ttl --clear-cache --server --cache-dir --update --no-update --wp-content-dir --wp-plugins-dir --wp-version-detection --main-theme-detection --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --themes-list --themes-detection --themes-version-all --themes-version-detection --timthumbs-list --timthumbs-detection --config-backups-list --config-backups-detection --db-exports-list --db-exports-detection --medias-detection --users-list --users-detection --passwords --usernames --multicall-max-passwords --password-attack --stealthy") function __wpscan_completion() {
local _opt_
local OPTS=('--help' '--hh' '--version' '--url' '--ignore-main-redirect' '--verbose' '--output' '--format' '--detection-mode' '--scope' '--headers' '--user-agent' '--vhost' '--random-user-agent' '--user-agents-list' '--http-auth' '--max-threads' '--throttle' '--request-timeout' '--connect-timeout' '--disable-tlc-checks' '--proxy' '--proxy-auth' '--cookie-string' '--cookie-jar' '--cache-ttl' '--clear-cache' '--server' '--cache-dir' '--update' '--no-update' '--wp-content-dir' '--wp-plugins-dir' '--wp-version-detection' '--main-theme-detection' '--enumerate' '--exclude-content-based' '--plugins-list' '--plugins-detection' '--plugins-version-all' '--plugins-version-detection' '--themes-list' '--themes-detection' '--themes-version-all' '--themes-version-detection' '--timthumbs-list' '--timthumbs-detection' '--config-backups-list' '--config-backups-detection' '--db-exports-list' '--db-exports-detection' '--medias-detection' '--users-list' '--users-detection' '--passwords' '--usernames' '--multicall-max-passwords' '--password-attack' '--stealthy')
COMPREPLY=() COMPREPLY=()
for _opt_ in ${OPTS[@]}; do for _opt_ in "${OPTS[@]}"; do
if [[ "$_opt_" == "$2"* ]]; then if [[ "$_opt_" == "$2"* ]]; then
COMPREPLY+=("$_opt_") COMPREPLY+=("$_opt_")
fi fi
done done
} }
complete -F __wpscan_completion wpscan complete -F __wpscan_completion wpscan
fi

View File

@@ -1,7 +1,10 @@
# Bash-it ![logo](https://github.com/Bash-it/media/raw/master/media/Bash-it.png)
![Build Status](https://github.com/Bash-it/bash-it/workflows/CI/badge.svg?branch=master)
![Build Status](../../../workflows/CI/badge.svg?event=push)
![Docs Status](https://readthedocs.org/projects/bash-it/badge/) ![Docs Status](https://readthedocs.org/projects/bash-it/badge/)
[![Join the chat at https://webchat.freenode.net/?channel=#bash-it](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channel=#bash-it) ![License](https://img.shields.io/github/license/Bash-it/bash-it)
![shell](https://img.shields.io/badge/Shell-Bash-blue)
[![Join the chat at https://web.libera.chat/?channel=#bash-it](https://img.shields.io/badge/chat-on%20Libera.Chat-brightgreen.svg)](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:)
@@ -39,7 +42,8 @@ Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-i
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it`` ``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
2) Run ``~/.bash_it/install.sh`` 2) Run ``~/.bash_it/install.sh``
Thats it! :smiley: That's it! :smiley:
You can check out more components of Bash-it, and customize it to your desire. You can check out more components of Bash-it, and customize it to your desire.
For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/). For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/).
@@ -53,10 +57,8 @@ please feel free to read through this page if you're interested in how Bash-it l
## Contributors ## Contributors
* [List of contributors][contribute] [List of contributors](https://github.com/Bash-it/bash-it/contributors)
## License ## License
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE). Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).
[contribute]: https://github.com/Bash-it/bash-it/contributors

View File

@@ -13,3 +13,4 @@ You should be familiar with them in order to fully utilize Bash-it.
search search
reload reload
doctor doctor
profile

31
docs/commands/profile.rst Normal file
View File

@@ -0,0 +1,31 @@
.. _profile:
Bash-it Profile
---------------
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
bash-it profile load my_profile

View File

@@ -8,3 +8,16 @@ your Bash profile when you make changes.
Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value, Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value,
Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions. Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions.
.. warning::
When changing theme, do not use ``bash-it reload``. Instead, use :ref:`restart`.
.. _restart:
Bash-it restart
^^^^^^^^^^^^^^^
Similar to :ref:`reload`, ``bash-it restart`` can be used to restart your shell.
Instead of reloading your Bash profile, this command re-runs Bash (using exec).
This is stronger than simple reload, and is similar to the effect of closing and reopening your terminal.

View File

@@ -147,6 +147,11 @@ Plugin Disable Callbacks
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.
Using the pre-commit hook Using the pre-commit hook
------------------------- -------------------------

View File

@@ -1,3 +1,4 @@
sphinx==3.2.1 sphinx==3.2.1
sphinx-rtd-theme==0.5.0 sphinx-rtd-theme==0.5.0
sphinxemoji==0.1.8 sphinxemoji==0.1.8
docutils==0.17.1

View File

@@ -70,11 +70,13 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) * ``battery`` - Battery information (you'll need to enable the ``battery`` plugin)
* ``clock`` - Current time in ``HH:MM:SS`` format * ``clock`` - Current time in ``HH:MM:SS`` format
* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) * ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ )
* ``duration`` - Duration of the last command. See :ref:`Command duration <command_duration>` for details.
* ``gcloud`` - Current gcloud active account * ``gcloud`` - Current gcloud active account
* ``hostname`` - Host name of machine * ``hostname`` - Host name of machine
* ``in_toolbox`` - Show identifier if running inside a `toolbox <https://github.com/containers/toolbox>`_ * ``in_toolbox`` - Show identifier if running inside a `toolbox <https://github.com/containers/toolbox>`_
* ``in_vim`` - Show identifier if running in ``:terminal`` from vim * ``in_vim`` - Show identifier if running in ``:terminal`` from vim
* ``k8s_context`` - Show current kubernetes context * ``k8s_context`` - Show current kubernetes context
* ``k8s_namespace`` - Show current kubernetes namespace
* ``last_status`` - Exit status of last run command * ``last_status`` - Exit status of last run command
* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` * ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv``
and ``conda`` supported) and ``conda`` supported)

View File

@@ -22,7 +22,7 @@ Examples:
# Disable theming # Disable theming
export BASH_IT_THEME="" export BASH_IT_THEME=""
You can easily preview the themes in your own shell using ``BASH_PREVIEW=true bash-it reload``. You can easily preview the themes in your own shell using ``bash-it preview``.
If you've created your own custom prompts, we'd love it if you shared them with everyone else! Just submit a Pull Request. If you've created your own custom prompts, we'd love it if you shared them with everyone else! Just submit a Pull Request.
You can see theme screenshots on `wiki/Themes <https://github.com/Bash-it/bash-it/wiki/Themes>`_. You can see theme screenshots on `wiki/Themes <https://github.com/Bash-it/bash-it/wiki/Themes>`_.

39
hooks/check-clean-files-txt.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
file=$1
# Should only be run on clean_files.txt
if [ "$file" != "clean_files.txt" ]; then
echo "Please run this script on clean_files.txt only!"
exit 1
fi
function compare_lines() {
prev=""
while read -r line; do
# Skip unimportant lines
[[ $line =~ "#" ]] && continue
[[ $line == "" ]] && continue
# Actual check
if [[ $prev > $line ]]; then
echo "$line should be before $prev"
exit 1
fi
prev=$line
done <<< "$1"
}
# We compare using the legacy way
shopt -s compat31
# Test root files
compare_lines "$(grep -v "/" "$file")"
# Test root directory
compare_lines "$(grep "/$" "$file")"
# Test non root directories
compare_lines "$(grep "/." "$file")"
shopt -u compat31
# Yay, all good!
exit 0

View File

@@ -18,4 +18,4 @@ for file in "$@"; do
fi fi
done done
exit $exit_code exit "${exit_code:-0}"

View File

@@ -18,4 +18,4 @@ for file in "$@"; do
fi fi
done done
exit $exit_code exit "${exit_code:-0}"

Some files were not shown because too many files have changed in this diff Show More