Update lib/format functions
#107
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During the course of extracting and testing
tests/log/helpers.bashintolib/testing/log, I started updating@go.strip_formatting_codessuch that it will expand all codes the original string before stripping them.After that, I thought it would be nice to do away with the requirement that the caller declare predetermined
__go_*variables before using these functions, and switch to implementations that rely onprintf -vsuch that the caller can pass in the name of the variable it will use to store the result. Hence I imported thelib/validationmodule to validate the result variable name for each function.Then I learned after observing test failures under Bash 3.2.57(1)-release that Bash versions before 4.1 can't use
printf -vto assign to subscripted array variables. I developed the new@go.array_printffunction as a portable workaround, which relies on@go.splitfromlib/stringsunder the hood.