Commit Graph

97 Commits (0e0e0d30351f5b0e6e61510b7aacc33e23f85de9)

Author SHA1 Message Date
John D Pell b0862899d7 completion/alias: fix tests 2022-01-30 16:13:54 -08: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
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 afeb4d6e11 lib/search: `shellcheck`
SC2076
SC2091
SC2004
SC2086
SC2207
2022-01-28 13:35:17 -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
John D Pell 2343e2dd35 lib/preexec: tests! 2022-01-27 12:40:38 -08:00
John D Pell 805eab804c lib/helpers: fix profile subcommand tests 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
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
John D Pell 04c7424de5 completion/system: fix tests for `profile` command 2022-01-08 08:33:16 -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 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
Noah Gorny 4c4b138671 tests: Add more bash-it profile tests 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
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
John D Pell 3654198deb Tests for 'default' prefix 2021-08-26 14:11:41 -07:00
Noah Gorny 02f6654841 test: Add bash-it help plugins test 2021-03-21 22:07:24 +02: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
Noah Gorny 3838f12498 Add tests for _binary_exists 2020-10-21 11:02:55 +03:00
Travis Swicegood ac3957393e Update tests so github-cli is expected 2020-10-10 02:39:02 +03:00
Ahmad Assaf 95b60098cd
Update helpers.bats
Fix the `assert_success` by adding the required `run`
2020-09-24 05:20:04 -07:00
cornfeedhobo f40bfa80f1
system completion nitpicks
- General cleanup of system completion
- Use homebrew's completion loading script instead
- Deprecate completions covered by system
- Adjust load priority of brew to happen after system
2020-09-21 09:07:09 -05:00
Nils Winkler 2f91e95af6
Adding log library to search tests
This might help with #1635.
2020-08-04 10:58:25 +02:00
Noah Gorny 72dbfd2480 lib: log: Insert log level before message prefix
Also fix tests accordinly
2020-07-02 21:11:40 +03:00
Noah Gorny 3069af37e0 tests: Include lib log 2020-07-02 21:11:40 +03:00
Noah Gorny 9a23725ce0 log: Add BASH_IT_LOG_PREFIX option
Also add a new test to check it
2020-06-25 00:16:16 +03:00
Noah Gorny 5263f5ac59 test: Add lib log basic testing 2020-06-23 15:59:14 +03:00
Noah Gorny 3eac73f613 plugins: Rename gitstatusd plugin to gitstatus 2020-06-22 14:57:05 +03:00
Noah Gorny 4f4bae95e4 tests: Fix search git test 2020-06-22 14:56:13 +03:00
Nils Winkler 62bf3bf097
Fix search plugin tests
Had to move the `cite` definition up a couple of lines, since `_about`
is used in some of the tested plugins

Fixes #1582
2020-05-02 14:19:15 +02:00
Nils Winkler 818a95d79c
Refactored test setup code
Removed the copy/paste code, moved it into a reusable function that can
be called from the `local_setup` function as needed. Also simplified the
handling of the $HOME variable since @rico-chet provided a better way of
doing this.
2020-04-21 08:25:40 +02:00
Nils Winkler 34993f5da3
Excluding enabled directory when setting up test fixtures 2020-04-21 08:25:40 +02:00
Nils Winkler 3093273425
Updated rsync command to work with latest version of bats-core 2020-04-21 08:25:39 +02:00
John McBride 036c26dbed Update jump plugin
- remove z plugin
- remove fasd plugin
- update test that referenced fsad

Signed-off-by: John McBride <jpmmcbride@gmail.com>
2020-02-03 11:43:24 -07:00
Konstantin Gredeskoul 09c2be9d6b Refactor (extract utilities + add tests) & more…
* Extracting common utilities into utilities.bash
 * Adding new tests for utilities
 * Relocating the cache file to be under $BASH_IT
 * Removing cache cleanup deferral code for now
 * Wiping the cache in local_setup in tests.
2018-11-23 16:40:35 -08:00
Konstantin Gredeskoul baae0305b6 Speed up bash-it Search & support exact matches
This commit improves Bash-It search functionality in a couple of ways:

 * bash-it search (with no arguments) will print detailed help.
 * bash-it search now accepts terms prefixed with '@' sign, indicating an exact match.
 * bash-it search now performs smarter caching of the component listings/status

New search syntax is as follows:

   bash-it search [-|@]term1 [-|@]term2 [ --enable | --disable | --help ]
2018-11-19 11:55:36 -08:00
Nils Winkler e2f00b1eb6 Checking for link target 2017-10-14 18:02:04 +02:00
Nils Winkler 80e510d65b Added assert_link_exist function and use that 2017-10-14 18:02:04 +02:00
Nils Winkler 2691a5b138 Moved to bats-assert for assert functions 2017-10-14 18:00:43 +02:00
Nils Winkler 8319545b0a Switched to Bats-core as a submodule
Can't use the official v0.4.0 release, since our tests rely on a change
that was made after the release of v0.4.0.

This code currently uses an unversioned commit of the bats-core repo, we
will switch to a supported version once it has been released, e.g.
v0.4.1.
2017-10-14 18:00:43 +02:00
Nils Winkler 145ec5dfaa Copied command_exists function to the helpers lib so that there is no hidden dependency on the base plugin
The original command_exists function will stay in the base plugin, but will no longer be used by other plugins or themes.
2017-09-17 21:05:59 +02:00
Nils Winkler f57bd1e131 Fixed issues with migrating components with the same name
dirs.plugin.bash was recognized while looking for dirs.completion.bash in the global enabled directory.
2017-09-17 21:05:59 +02:00
Nils Winkler aa9a63a10e Added message after migrating about possible fixes.
See #985 for background.
2017-09-17 21:05:59 +02:00
Nils Winkler 653437e2e1 Some more tests for disable all 2017-09-17 21:05:58 +02:00
Nils Winkler 729f21c106 Reading bash-it help lists aliases from global enabled directory 2017-09-17 21:05:58 +02:00
Nils Winkler c26476f56e Fixed bash-it help aliases for todo.txt-cli 2017-09-17 21:05:58 +02:00
Nils Winkler e0554cb512 Test cases and fix for bash-it help aliases foo 2017-09-17 21:05:58 +02:00
Nils Winkler 4cda9c0a43 Started work on bash-it help aliases 2017-09-17 21:05:58 +02:00