Copying from this last comment on the first (primary) PR - there is some outstanding work that may be worth doing, and it may make sense to break these up into separate issues. For now here is the full list:
Feel strongly about
Subtrees get out of hand quickly for even the smallest of repos. We should try to find a way to not force all users to deal with ever-growing helper lib checkouts.
filehandling/lib (even though it was straight from SO) at the very least needs some comments but it really could be better if the logic flow was cleaned up to be more readable.
The : ${FOO:?"Something"} pattern is really hard to read when compared to an if/else
The [[ <check> ]] | die "foo" and <cmd> || die patterns are also really hard to read when compared to an if/else
If/else pattern where the else is returning 1 should be changed to be if !condition return 1 and then do the positive condition (unconditionally)
tests-for-this-repo needs a better name. Don't know what it should be but the current one isn't great.
Bats tests and Dockerfiles should have more liberal use of newlines in tests to show given/when/then sections
[[ <check> ]] by itself should go away as a pattern as it's unclear what it's doing without knowing bash in depth
Should probably fix
local rc=0/return $rc pattern looked in most cases superfluous. Some tests do seem to need it but we should probably use a named variable rather than return code as the saved state variable.
run_tests should probably do a loop over an array rather than have 3 individual sections on what it's testing
We should probably use echo with echo message instead of echo -e '\nmessage
tests-for-this-repo/run-bats-tests quote both sting values that are being compared
On the fence but leaning towards needing a fix
Some of your awk chomping of refs could be done with sed
Even though all of the script import -e flag, I think it would be good to explicitly set it in all toplevelish scripts that you expect might want to bail on errors
k8s/platform_login seems like it probably doesn't need main function given that the whole thing is tiny
Copying from this last comment on the first (primary) PR - there is some outstanding work that may be worth doing, and it may make sense to break these up into separate issues. For now here is the full list:
Feel strongly about
filehandling/lib
(even though it was straight from SO) at the very least needs some comments but it really could be better if the logic flow was cleaned up to be more readable.: ${FOO:?"Something"}
pattern is really hard to read when compared to an if/else[[ <check> ]] | die "foo"
and<cmd> || die
patterns are also really hard to read when compared to an if/elseif !condition return 1
and then do the positive condition (unconditionally)tests-for-this-repo
needs a better name. Don't know what it should be but the current one isn't great.[[ <check> ]]
by itself should go away as a pattern as it's unclear what it's doing without knowing bash in depthShould probably fix
local rc=0
/return $rc
pattern looked in most cases superfluous. Some tests do seem to need it but we should probably use a named variable rather than return code as the saved state variable."
and\
echo
withecho message
instead ofecho -e '\nmessage
On the fence but leaning towards needing a fix
-e
flag, I think it would be good to explicitly set it in all toplevelish scripts that you expect might want to bail on errorsNits
/mnt
volume would probably be something elseRandom thoughts