New named parameters implementation #86
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.
As already mentioned in #45, I have taken inspiration from a nice trick I found online. I expanded upon it to create the same aliases as in v2.
This is a proposal and if you find it appropriate we could work on it to expand it to fully cover v2 aliases or introduce new ones as well. For the time being I have created the
[string]
and[integer]
aliases.In the code, I think it would be nice to add comments to guide future contributors. I have added some minimal ones so far. Also, contrary to the previous implementation, I named internal variables that are not leaked to the calling code with friendly names to make it easier to follow the flow. Functions, aliases, etc that will be available in the scope of the caller have been namespaced with
bash_oo_<library-name>
. I have alsoset -eu
(probably should have added-o pipefail
). I think it would be a good idea to enable strict mode and take care of initializing our variables and handling any error. Moreover, I have used shfmt to format the source code.I have tried to follow a TDD approach. As we have already discussed, I have used bats and a couple 3rd party libraries instead of rolling our own custom test suite. To run the tests, there is script that can be called with
bin/run_tests
.