Config changes

This commit is contained in:
marc
2022-12-04 19:31:30 +01:00
parent 69e1dc2eb4
commit ccaca2cbe1
4 changed files with 32 additions and 45 deletions

View File

@@ -13,15 +13,16 @@ check_template () {
if [ -z "$TEMPLATE" ]; then
echo "No template given"
list_templates
exit 1
return 1
elif [ ! -e "$TEMPLATES_DIR/$TEMPLATE" ]; then
echo "The given template '$TEMPLATE' doesn't exist!"
list_templates
exit 1
return 1
fi
}
devenv_install() {
TEMPLATE=$1
install -m 644 $TEMPLATES_DIR/$TEMPLATE/* ./
echo "use flake . --impure" > .envrc
direnv allow
@@ -29,22 +30,26 @@ devenv_install() {
devenv_init() {
TEMPLATE=$1
check_template $TEMPLATE
devenv_install
if ! check_template $TEMPLATE ; then
return 1
fi
devenv_install $TEMPLATE
}
devenv_sandbox() {
DIRECTORY=$1
if [ -z "$DIRECTORY" ]; then
show_help_sandbox
exit 1
return 1
fi
SANDBOX_DIR="$SANDBOXES_DIR/$DIRECTORY"
TEMPLATE=$2
if [ -z "$TEMPLATE" ]; then
TEMPLATE=$DIRECTORY
fi
check_template $TEMPLATE
if ! check_template $TEMPLATE; then
return 1
fi
if [ ! -e $SANDBOX_DIR ]; then
echo "Creating sandbox at $SANDBOX_DIR with template $TEMPLATE"
mkdir -p $SANDBOX_DIR