cyberark / bash-lib

Library for bash utility methods and tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clean up

izgeri opened this issue · comments

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

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

Nits

Random thoughts

@sgnn7 @dividedmind you were both involved with this before, please feel free to update / revise this if it makes sense.