diff --git a/Makefile.toml b/Makefile.toml index 2ba8629..257c76d 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -41,7 +41,24 @@ command = "cargo" args = ["clippy", "--", "--deny", "warnings"] [tasks.header-add] -script = { file = "./scripts/add_header_if_missing.sh" } +script = [ + "if [ \"$#\" -lt 2 ]; then", + " echo 'Usage: $0 '", + " exit 1", + "fi", + "HEADER_FILE=\"$1\"", + "FILE_PATTERN=\"$2\"", + "LICENSE_HEADER=$(cat \"$HEADER_FILE\")", + "shopt -s globstar", + "for file in $FILE_PATTERN; do", + " if [[ -f \"$file\" && \"$file\" == *.rs ]]; then", + " if ! grep -q 'Copyright 2024, Horizen Labs, Inc.' \"$file\"; then", + " echo 'Adding license header to $file'", + " echo -e \"$LICENSE_HEADER\\n$(cat $file)\" > \"$file\"", + " fi", + " fi", + "done" +] args = ["HEADER-APACHE2", "./!(target)/**/*.rs"] [tasks.header-check]