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 also set -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.
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
.