diff --git a/.version b/.version index 437459c..73462a5 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.5.0 +2.5.1 diff --git a/.vscode/settings.json b/.vscode/settings.json index b81acc2..dbc7804 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ "compile-hero.disable-compile-files-on-did-save-code": true, "shellcheck.enableQuickFix": true, "workbench.colorTheme": "Popping and Locking", - "window.zoomLevel": 0, + "window.zoomLevel": 1, "customPresentationMode.backup": {}, "gruvboxMaterial.jsson1Comments": false, "git-graph.markdown": false diff --git a/README.adoc b/README.adoc index 3a5997b..928c8ee 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,7 @@ [separator=—] = Bashmatic® — BASH-based DSL helpers for humans, sysadmins, and fun. // vim: ft=asciidoc -:author: Version v2.4.6 +:author: Version v2.5.0 :doctype: book :source-highlighter: rouge :rouge-style: base16.monokai diff --git a/README.pdf b/README.pdf index c3cbb3d..f2eafc2 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/doc/USAGE.pdf b/doc/USAGE.pdf index 10284d1..ea41bdb 100644 Binary files a/doc/USAGE.pdf and b/doc/USAGE.pdf differ diff --git a/lib/util.sh b/lib/util.sh index 93b30e8..24f6704 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -34,6 +34,10 @@ util.rot13() { } alias rot13=util.rot13 +__grep="${GrepCommand/ */}" +[[ -n ${__grep} && -x ${__grep} ]] || { + export GrepCommand="$(command -v grep) -E" +} util.is-variable-defined() { local var_name="$1" @@ -211,11 +215,11 @@ util.functions-starting-with-csv() { util.functions-matching() { local prefix="${1}" local extra_command=${2:-"cat"} - set | ${GrepCommand} '^${prefix}' | sedx 's/[\(\)]//g;' | /usr/bin/tr -d ' ' | /usr/bin/tr '\n' ' ' + declare -f | ${GrepCommand} "^${prefix}" | sedx 's/[\(\)]//g;' | /usr/bin/tr -d ' ' | /usr/bin/tr '\n' ' ' } util.functions-matching.diff() { - for m in "$@"; do + while true; do [[ -z "$1" ]] && break for e in $(util.functions-matching "${1}"); do printf "${e/$1/}\n" diff --git a/test/util_test.bats b/test/util_test.bats index 2a3cb76..e7c24cb 100644 --- a/test/util_test.bats +++ b/test/util_test.bats @@ -5,6 +5,10 @@ load test_helper source lib/util.sh source lib/user.sh source lib/is.sh +source lib/db.sh +source lib/db_cli.sh +source lib/db_rails.sh +source lib/db_top.sh set -e @@ -67,3 +71,11 @@ moo() { set -e [ $code -ne 0 ] } + +@test "util.functions-matching.diff" { + set -e + local -a actions=($(util.functions-matching.diff db.actions. | sort)) + local num=${#actions[@]} + [[ $num -gt 10 ]] && + [[ "${actions[0]}" == "commands" ]] +}