Commit Diff
--- /dev/null +++ .local/bin/fmtconf @@ -0,0 +1,14 @@ +#!/usr/bin/awk -f +{ + gsub(/^[ \t]+|[ \t]+$/, "") + + if ($0 == "") { print ""; next } + + if ($0 ~ /^}/) depth-- + if (depth < 0) depth = 0 + + for (i = 0; i < depth; i++) printf "\t" + print + + if ($0 ~ /\{$/) depth++ +}
