Commit Graph

93 Commits (076afcd3295900555da5d12385fb8cde7a595936)

Author SHA1 Message Date
John D Pell 4e0e59230b lib/command_duration: rename `theme/command_duration.theme`
Rename the `theme/command_duration.theme` file as it's not really got anything to do with theming or SCM.
2022-03-04 12:58:07 -08:00
Koichi Murase ee853670a1 bash_it: suppress a false error by shellcheck 2022-02-19 17:17:45 +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 146107926e main: variable name cleanup 2022-02-10 10:46:33 -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
John D Pell 2a8d8ba540 lib/colors: rename `theme/colors` 2022-01-28 13:08:50 -08:00
John D Pell 7a0b353cea lib/preexec: rename `vendor/init.d/preexec.bash` 2022-01-25 13:00:04 -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 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 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 cace3a591d main: use `_command_exists`
Addresses bash-it/bash-it#1632
2021-09-19 21:58:48 -07: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
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
buhl 49d7d2e8c4 Getting Bash-it to use the vendored composure
Fixed tests
Fixed install.sh and bash_it.sh
Added gitattributes to the vendor folder
Changed documentation
2021-02-02 16:34:04 +01:00
buhl 29855ed1e6 Adding preexec as a vendored library
Added a vendored lib loading routine in bash-it.sh
Added documentation on how to vendor libs in bash-it
Added and fixed plugins using preexec
Added tests for two plugins
Removed the old preexec lib
2021-01-23 18:31:18 +01:00
BarbUk 13e795c995
add command time duration plugin (#1683) 2020-12-27 18:48:17 +02:00
Nils Winkler e0ee6bd32f
Added missing colon and space while loading custom files
Looks like I missed this during my review, @NoahGorny
2020-07-07 13:17:17 +02:00
Noah Gorny 811c9ecd71 bash-it: Reorder main bash-it.sh so logs can happen 2020-07-02 20:13:57 +03:00
Noah Gorny 453c17de3d bash-it: Add logs to bash-it.sh 2020-06-30 20:58:09 +03:00
Travis Swicegood 2d6085b033 Switch from false to skip – I think that's more clear 2018-12-05 21:58:13 -06:00
Travis Swicegood 286e695910 Ensure that shellcheck can find these files (SC1090) 2018-12-05 20:59:37 -06:00
Travis Swicegood e5b68695c0 Attempt to simplify by not using aliases 2018-12-04 22:02:10 -06:00
caguettaz f06439edc3 [cleanup] Harmonized variable names, added support for global config files 2018-12-04 14:30:11 +01:00
Christophe Aguettaz 1ba023c97a [bugfix][wip] Fixed issue with Debian's bash-completion 2018-11-23 22:25:14 +01:00
daniel.schroeder b03a93cd2b
disable theming by checking theme var for value 2018-11-02 10:47:55 +01:00
Nils Winkler 5d99d6cb9b Fixed some shellcheck warnings
Also fixed one broken case of `unset`.
2018-05-31 18:05:25 +02:00
Nils Winkler 0028dc7661 Fixed indentation to two spaces, like in the rest of the file 2018-05-31 17:57:09 +02:00
Piotr Rogoża b288ecbd27 Added legacy alias reload: https://github.com/Bash-it/bash-it/issues/1120#issuecomment-354376835 2018-04-25 19:53:06 +02:00
Piotr Rogoża 89d1661d23 Replaced reload section with proper function.
Added completion for reload.
Fixed order in completion
Added unit tests for completion
The variable BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE has to be unset.
2018-04-18 21:51:20 +02:00
Piotr Rogoża b1dbf2f7e0 Added additional parameter for bash-it: reload
Added creating an alias if command does not exist
2018-04-18 21:51:20 +02:00
Shashank Bharadwaj 353cb210d4 Add priliminary support for perforce SCM
This patch adds very simple support for the Perforce SCM:
    https://www.perforce.com/

Although perforce is proprietary software, it's somewhat prevalent in enterprise
companies. This patch looks to provide some basic bash_it functionality that
I've come to love for git. I base everything off of two perforce commands:
    $ p4 set
This command does not require a connection the perforce server, it simply tells
us if a directory is managed by the Perforce SCM or not. In addition the
command:
    $ p4 opened

is used to provide the list of pending changes in the client and the number of
opened files in the client. The `p4 opened` command requires a connection to the
perforce server, hence it's run under a `timeout` command. The "p4 opened"
processing into it's own bash file that now has to be sourced at the top-level
bash-it.sh. Since the processing in simple the newly added: _p4-opened-counts
function returns a number of things that are not currently used, but since I had
awk open and doing the processing, I've chosen to include them in the output
anyway.

Testing:
  - Tested with the powerline-multiline theme in a few perforce based
    workspaces/clients
  - Ran:
      ❯ shellcheck themes/p4helpers.theme.bash
    and fixed all the errors
  - Ran the test suite:
      ❯ test/run
      [...]
      182 tests, 0 failures, 1 skipped
2018-02-14 17:53:09 -08:00
Dan Wendorf 150e82b221 Refactor git functionality into githelpers.theme.bash
- Add unit tests around git functionality
2017-12-18 09:05:33 -08:00
Nils Winkler a75a53b786 Merge pull request #1043 from nwinkler/enabled-global
Move enabled components to a global directory
2017-09-28 08:05:58 +02:00
pmoranga 0fc26dfad2 Add some description 2017-09-22 12:24:15 +02:00
Nils Winkler 0fe2710c61 More unit tests for loading from global directory structure 2017-09-17 21:05:59 +02:00
Nils Winkler fd637a3dc6 Loading components from global enabled directory 2017-09-17 21:05:59 +02:00
Nils Winkler fb6fcaeb06 Fixed test case where the bash_it.sh would fail with a non-zero return value
This was caused by the way the check for installed preview apps was handled.
2017-09-17 21:05:59 +02:00
Nils Winkler 2acb87e882 Fixed some more shellcheck complaints 2017-09-17 21:05:58 +02:00
Nils Winkler 6981fa091d Add tests for bash_it.sh script 2017-09-17 21:05:58 +02:00
Nils Winkler e53b5dc96e Add some TODO items 2017-09-17 21:05:58 +02:00
pmoranga f65133ac11 Fix execution of trap DEBUG on subshells 2017-09-15 16:06:12 +02:00
Rodrigo Lanza 3e60efd19d Recursive load of out of place custom config files 2017-09-14 22:50:52 +02:00
Nils Winkler 228b86f3d1 Change order of theme loading
The base theme is now loaded after plugins, since it now uses the
`command_exists` function, which is defined in the `base` plugin.
2017-06-24 17:31:31 +02:00
Adam Karim a896cb2c44 Allow for having custom scripts outside of bash-it. 2016-11-29 09:21:26 -08:00
raphaelehret 6c5e1c9dfb Replaced backticks with `$()` 2016-11-28 14:07:16 +01:00
MunifTanjim 6a601abc84 fix npm completion 2016-10-28 02:37:07 +06:00
Ron Waldon 14525efefa load theme _after_ loading any plugins, etc 2016-05-25 17:32:33 +10:00
Fahad Hossain a8124a02e8 Fix unicode line wrap problem (issue #409)
Fix unicode line wrap issue mentioned in #409
Nota bene, This fixed the problem for me on Fedora 21 and Ubuntu 15.04
Needs to be tested on other systems
2015-05-06 22:37:24 +06:00