blob: 1641859e98104c5b489fdb4cfe9b26904a6def25 (
plain) (
tree)
|
|
#!/usr/bin/env bash
if [ -n "${BASHRC_TEXT+x}" ]; then
return 0
else
readonly BASHRC_TEXT=1
fi
alias dos2eol='sed --binary --in-place '"'"'s/\(\r\?\)$//'"'"
alias eol2dos='sed --binary --in-place '"'"'s/\r\?$/\r/'"'"
alias trim='sed --binary --in-place '"'"'s/[[:blank:]]*\(\r\?\)$/\1/'"'"
alias trimeol='sed --binary --in-place -e :a -e '"'"'/^\n*$/{$d;N;ba}'"'"
alias trimdoseol='sed --binary --in-place -e :a -e '"'"'/^\(\r\n\)*\r$/{$d;N;ba}'"'"
alias eol='sed --binary --in-place '"'"'$a\'"'"
alias doseol='sed --binary --in-place '"'"'$s/\r\?$/\r/;a\'"'"
alias trimbom='sed --binary --in-place '"'"'1 s/^\xef\xbb\xbf//'"'"
lint() {
trim "$@" && trimeol "$@" && eol "$@"
}
doslint() {
trim "$@" && trimdoseol "$@" && doseol "$@"
}
|