diff --git a/Dockerfile b/Dockerfile index 8c227e2..6ed798d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM node:alpine -RUN apk add --no-cache bash>5.0.16-r0 git>2.26.0-r0 +RUN apk add --no-cache bash>5.0.16-r0 git>2.26.0-r0 fd>8.1.1-r0 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 56c217b..77b2966 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -73,10 +73,10 @@ handle_files () { echo -e "${RED}ERROR [✖] Can't find the file: ${YELLOW}${FILELIST[index]}${NC}" exit 2 fi - if [ "$index" == 0 ]; then - COMMAND_FILES+=("-wholename ${FILELIST[index]}") + if [ $index == 0 ]; then + COMMAND_FILES+=("${FILELIST[index]}") else - COMMAND_FILES+=("-o -wholename ${FILELIST[index]}") + COMMAND_FILES+=("|${FILELIST[index]}") fi done FILES="${COMMAND_FILES[*]}" @@ -125,9 +125,9 @@ check_additional_files () { if [ -n "$FILES" ]; then if [ "$MAX_DEPTH" -ne -1 ]; then - FIND_CALL=('find' '.' '-type' 'f' '(' ${FILES} ')' '-not' '-path' './node_modules/*' '-maxdepth' "${MAX_DEPTH}" '-exec' 'markdown-link-check' '{}') + FIND_CALL=('fd' '--type' 'f' '('"${FILES// /}"')' '--max-depth' "${MAX_DEPTH}" '.' '--exec' 'markdown-link-check') else - FIND_CALL=('find' '.' '-type' 'f' '(' ${FILES} ')' '-not' '-path' './node_modules/*' '-exec' 'markdown-link-check' '{}') + FIND_CALL=('fd' '--type' 'f' '('"${FILES// /}"')' '.' '--exec' 'markdown-link-check') fi add_options @@ -182,9 +182,9 @@ if [ "$CHECK_MODIFIED_FILES" = "yes" ]; then else if [ "$5" -ne -1 ]; then - FIND_CALL=('find' ${FOLDERS} '-name' '*'"${FILE_EXTENSION}" '-not' '-path' './node_modules/*' '-maxdepth' "${MAX_DEPTH}" '-exec' 'markdown-link-check' '{}') + FIND_CALL=('fd' '.' ${FOLDERS} '-e' "${FILE_EXTENSION}" '--max-depth' "${MAX_DEPTH}" '--exec' 'markdown-link-check') else - FIND_CALL=('find' ${FOLDERS} '-name' '*'"${FILE_EXTENSION}" '-not' '-path' './node_modules/*' '-exec' 'markdown-link-check' '{}') + FIND_CALL=('fd' '.' ${FOLDERS} '-e' "${FILE_EXTENSION}" '--exec' 'markdown-link-check') fi add_options