Commit Graph

70 Commits (85a77f1e46038436670c63ddb5ce21104f2a581b)

Author SHA1 Message Date
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 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 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
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
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
Noah Gorny 3069af37e0 tests: Include lib log 2020-07-02 21:11:40 +03: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
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
Nils Winkler 5ff873e058 Fixed "bash-it help aliases" cases, more to come... 2017-09-17 21:05:58 +02:00
Nils Winkler 3e9c5655b1 Added xargs fix to some more wc -l invocations
Calling `xargs` removes any leading whitespace, which is introduced by
the macOS version of `wc`. See
https://stackoverflow.com/a/12973694/1228454 for more info.
2017-09-17 21:05:58 +02:00
Nils Winkler d798bb8f06 Change test prefixes to match file name 2017-09-17 21:05:58 +02:00
Nils Winkler 9f3ef22538 Describe function supports new directory structure 2017-09-17 21:05:57 +02:00
Nils Winkler 9080f0e869 Add more tests for migration scenario 2017-09-17 21:05:57 +02:00
Nils Winkler 2b778ccbba Fix disable/migrate test case 2017-09-17 21:05:57 +02:00
Nils Winkler fd686cc2ae Fix one more path 2017-09-17 21:05:57 +02:00
Nils Winkler f72691fe85 Fix some more migration test cases 2017-09-17 21:05:57 +02:00
Nils Winkler 2ac08cae0f Fix one migration case 2017-09-17 21:05:57 +02:00
Nils Winkler 6fa235a825 Start work on migration to global directory 2017-09-17 21:05:57 +02:00
Nils Winkler e705e6c60f Check for link target 2017-09-17 21:05:57 +02:00
Nils Winkler 5f3627b9b7 Change the enable/disable functions to use the global directory 2017-09-17 21:05:57 +02:00
Nils Winkler b106d275a7 Move enable/disable functionality to global enabled directory 2017-09-17 21:05:57 +02:00
Nils Winkler 2581abdf54 Fix some issues that showed the todo.txt-cli aliases in the wrong way 2017-06-24 17:31:31 +02:00
Nils Winkler 94e68b96b5 Fix migration of todo.txt-cli component 2017-06-24 17:31:31 +02:00
Nils Winkler fc4ce80329 Add tests for enabling multiple plugins at the same time 2017-06-24 17:31:31 +02:00
Nils Winkler 1068e7916b Add tests for enabling aliases and completions 2017-06-24 17:31:31 +02:00