Various small additions

This commit is contained in:
Alexander Gehrke (crater2150) 2016-07-22 16:01:35 +02:00
parent fe3c0fb5d5
commit 05f6bf7007
11 changed files with 208 additions and 5 deletions

22
modules/conf/init Executable file
View file

@ -0,0 +1,22 @@
#!/bin/zsh
conf() {
local target=${conf_locations[${1}]}
if [[ -d ${target} ]]; then
cd ${target}
if ! [[ -w ${target} ]]; then
su
fi
elif [[ -f ${target} ]]; then
if ! [[ -w ${target} ]]; then
sudoedit ${target}
else
$EDITOR ${target}
fi
elif [[ -n ${target} ]]; then
echo "Conf target for $1 missing: $target"
else
echo "Unknown conf target: $1"
fi
}