diff --git a/README.md b/README.md index 647041d..8604180 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,21 @@ TODO: miaou-bash --uninstall ## TODO +* [ ] miaou-bash COMMAND_ERROR multiline +> + +╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +║ COMMAND_ERROR incus exec "$optional_project" "$target" <<-EOF + ln -fs "$host_zoneinfo" /etc/localtime + dpkg-reconfigure -f noninteractive tzdata +EOF + 1 ║ +╚════╦═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + ║ + ╟──▷ /opt/miaou-incus/tools/miaou-create:93 assign_host_zoneinfo + ╟──▷ /opt/miaou-incus/tools/miaou-create:183 create + ╟──▷ /opt/miaou-incus/tools/miaou-create:203
+ * [ ] prompt git shows version with `+` when there is more than one commit over current version. ie: v0.0.0 + 2 commits more should display v-1.0.0+ * [ ] semver_git_tag should append `RELEASE_NOTES.md` from this TODO markdown file, providing that NEW NOTE section below contains appropriate items to fulfill the current release note * [ ] git log ..HEAD --oneline diff --git a/bin/miaou-bash b/bin/miaou-bash index a43c192..bd1b13e 100755 --- a/bin/miaou-bash +++ b/bin/miaou-bash @@ -149,7 +149,7 @@ function on_error { print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" else failure_type="COMMAND_ERROR" - failure_payload="${BASH_COMMAND}" + failure_payload="${BASH_COMMAND%%$'\n'*}" # first line only print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" "${failure_payload}" load_tmp_error # cannot print_miaou_error after investigation diff --git a/etc/vim/vimrc.rookie b/etc/vim/vimrc.rookie index 1067dbd..47f7398 100644 --- a/etc/vim/vimrc.rookie +++ b/etc/vim/vimrc.rookie @@ -62,8 +62,8 @@ inoremap inoremap " Slower Scroll Wheel -nnoremap -nnoremap +nnoremap k +nnoremap j vnoremap k vnoremap j inoremap diff --git a/test/miaou-bash.test.bash b/test/miaou-bash.test.bash index 0c62c54..8935d63 100755 --- a/test/miaou-bash.test.bash +++ b/test/miaou-bash.test.bash @@ -69,6 +69,7 @@ function fail_type { failures+=("$cmd") return 1 } + function fail_stderr_count { ((test_count++)) local regex count="$2" @@ -87,6 +88,25 @@ function fail_stderr_count { failures+=("$cmd 2>_stderr") return 1 } + +function fail_miaou_count { + ((test_count++)) + local regex count="$2" + + cmd="./test/stub/scenario.bash $1" + # mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)" + if ! $cmd >/dev/null 2>/dev/null 3>_miaou; then + mapfile -t miaou <_miaou + if [[ "${#miaou[@]}" == "$count" ]]; then + echo -n . + return + fi + fi + + echo -n F + failures+=("$cmd 3>_miaou") + return 1 +} # main set -uo pipefail @@ -116,6 +136,7 @@ time { fail_stderr_count unbound_variable 1 fail_stderr_count child_error 4 + fail_miaou_count command_error_multiline 6 } failed=${#failures[@]} success=$((test_count - failed)) diff --git a/test/stub/scenario.bash b/test/stub/scenario.bash index e76ac3c..58473cd 100755 --- a/test/stub/scenario.bash +++ b/test/stub/scenario.bash @@ -12,6 +12,14 @@ function do_subshell_false { result=$(false) } +function do_command_error_multiline { + miaou-bash <<-EOF + echo ok + false + echo SHOULD NOT APPEAR +EOF +} + function do_subshell_term { echo first line.