ci.functions 448 B

123456789101112131415161718192021222324252627282930
  1. #
  2. # This file contains useful Bash functions
  3. # and can be "source"d from the scripts.
  4. #
  5. declare -a POSITIONAL_ARGS
  6. for a in "$@" ; do
  7. OPTION_COUNT+=1
  8. case "$a" in
  9. --*=*)
  10. [[ $a =~ --([^=]+)=(.*) ]]
  11. l=${BASH_REMATCH[1]//-/_}
  12. r=${BASH_REMATCH[2]}
  13. eval ${l^^}=\"$r\"
  14. ;;
  15. --*)
  16. [[ $a =~ --(.+) ]]
  17. l=${BASH_REMATCH[1]//-/_}
  18. eval ${l^^}=1
  19. ;;
  20. *)
  21. POSITIONAL_ARGS+=($a)
  22. ;;
  23. esac
  24. done
  25. runner() {
  26. ( set -x ; ${@} )
  27. }