aboutsummaryrefslogtreecommitdiff
path: root/aux/80-columns.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-07-27 11:31:02 -0300
committerEuAndreh <eu@euandre.org>2021-07-27 11:58:44 -0300
commit9e84b309cd0807ff029660d2f42a2397334efb2b (patch)
treed10f193190726891ff739ecb6655359166947bb5 /aux/80-columns.sh
parentTODOs.md: Add #task-1f103822-c865-254c-f6b6-4968f2fb473e (diff)
downloadgit-permalink-9e84b309cd0807ff029660d2f42a2397334efb2b.tar.gz
git-permalink-9e84b309cd0807ff029660d2f42a2397334efb2b.tar.xz
aux/: Stick to 80 columns
Diffstat (limited to 'aux/80-columns.sh')
-rwxr-xr-xaux/80-columns.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/aux/80-columns.sh b/aux/80-columns.sh
index 02a8e81..ae4660e 100755
--- a/aux/80-columns.sh
+++ b/aux/80-columns.sh
@@ -1,9 +1,12 @@
#!/bin/sh
set -eu
+# shellcheck disable=2068
for f in ${@:-$(cat -)}; do
- sed 's/\t/ /g' "$f" |
- awk -v FNAME="$f" 'length > 80 {
- printf "%s:%s:%s\n", FNAME, NR, $0
- }'
+ if [ "$(file -i "$f" | cut -d' ' -f2 | cut -d/ -f1)" = 'text' ]; then
+ sed 's/\t/ /g' "$f" |
+ awk -v FNAME="$f" 'length > 80 {
+ printf "%s:%s:%s\n", FNAME, NR, $0
+ }'
+ fi
done