From c2a3e8417a04cb90453e87ab2b27ebb598fe21be Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Thu, 29 Aug 2024 14:35:33 +0200 Subject: [PATCH] easier linter --- lint.sh | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/lint.sh b/lint.sh index fb40b6e..414b752 100644 --- a/lint.sh +++ b/lint.sh @@ -1,32 +1,14 @@ #!/bin/bash -if (( $# != 2 )); then +if (( $# < 1 )); then >&2 echo "Illegal number of parameters" exit 1 fi -INPUT=$1 -EXCLUDE=$2 - -function get_files() { -while read p; do - find "$p" -regex '.*\.\(c\|cpp\|h\)$' | grep -vFf $2 -done < $1 -} - -if [ ! -f $1 ]; then - echo "File not found!" - exit 1 -fi - -if [ ! -f $2 ]; then - echo "File not found!" - exit 1 -fi - # save unsaved work git stash --include-untracked -get_files $1 $2 | xargs clang-format -i + +clang-format -i "$@" git add -A && git commit -m "Lint"