Compare commits

..

No commits in common. "8cc45a40867d8a22baebe9a03dd0f4961656b6e7" and "eb1784eca00677c7561246f12046d08d4a7b9a51" have entirely different histories.

3 changed files with 6 additions and 85 deletions

View File

@ -113,27 +113,19 @@ list-ssh-keys() {
done
}
{{- if (or (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.osRelease.id "linuxmint") (eq .chezmoi.osRelease.id "ubuntu")) }}
# Show version of a Debian package
debversion() {
if [ -x dpkg ]; then
local pkgname="${1:?packagename required}"
dpkg -s $pkgname | grep Version
else
echo "not a Debian based system!"
return 42
fi
}
# Show files of a Debian package
deblist() {
if [ -x dpkg ]; then
local pkgname="${1:?packagenamme required}"
dpkg-query -L $pkgname
else
echo "not a Debian based system!"
return 42
fi
}
{{- end }}
# Run 'top' by a list of processes matching name.
topby() {

View File

@ -97,7 +97,6 @@
[core]
editor = vim
hooksPath = ~/.config/git-hooks
[push]
# default = matching

View File

@ -1,70 +0,0 @@
#!/bin/bash
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
checkBash()
{
local file="$1"
echo "checking for 'version' in $file"
now=$(date +'%Y-%m-%d %R')
sed -i "s/version: .*/version: $now/" "$file"
sed -i "s/Version: .*/Version: $now/" "$file"
git add "$file"
}
# Set (Last Modified: <date>) in CHANGELOG.md
checkChangelog()
{
local file="$1"
echo "checking for 'Last Modified' in $file"
now=$(date +'%Y-%m-%d')
sed -i "s/\(Last Modified: .*\)/\(Last Modified: $now\)/" "$file"
git add "$file"
}
# Use google-java-format to force code guidelines
# https://github.com/google/google-java-format
checkJavaFormat()
{
local file="$1"
google-java-format --dry-run -aosp --set-exit-if-changed "$file"
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "\e[31mJava coding guidelines validation failed for $file \e[0m" >&2
exit $retVal
fi
}
for FILE in $(exec git diff --cached --name-only --diff-filter=ACMR) ; do
# Fix them!
case $FILE in
*.java)
echo "checking @version in $FILE"
now=$(date +'%d.%m.%Y %R')
sed -i "s/@version .*/@version $now/" "$FILE"
echo "checking code style in $FILE"
checkJavaFormat "$FILE"
git add "$FILE"
;;
*.sh|*.profile)
checkBash "$FILE"
;;
CHANGELOG.md)
checkChangelog "$FILE"
;;
*.*|*/pre-commit)
echo "ignoring $FILE"
;;
*)
checkBash "$FILE"
;;
esac
done
exit