Updating batslib_count_lines to automatically detect trailing newlines and count them if present.
This works on the concept that a string has a trailing newline if it was intended -- e.g. via run --keep-empty-lines or similar.
Updating batslib_prefix and batslib_mark to accept --keep-empty-lines option to properly print empty lines and trailing newlines.
Updating batslib_print_kv_single_or_multi calls to batslib_prefix.
Will automatically detect trailing new lines (on a per-value basis).
If trailing newline is present, --keep-empty-lines will be passed to batslib_prefix.
This implements option 4 for batslib_count_lines and batslib_print_kv_single_or_multi, and option 2 for batslib_prefix and batslib_mark, as discussed in https://github.com/bats-core/bats-support/issues/11.
batslib_count_lines
to automatically detect trailing newlines and count them if present.run --keep-empty-lines
or similar.batslib_prefix
andbatslib_mark
to accept--keep-empty-lines
option to properly print empty lines and trailing newlines.batslib_print_kv_single_or_multi
calls tobatslib_prefix
.--keep-empty-lines
will be passed tobatslib_prefix
.This implements option 4 for
batslib_count_lines
andbatslib_print_kv_single_or_multi
, and option 2 forbatslib_prefix
andbatslib_mark
, as discussed in https://github.com/bats-core/bats-support/issues/11.Fixes https://github.com/bats-core/bats-support/issues/11.