#!/bin/bash

export ROOT=~/dotfiles
export DOTFILES=$ROOT

export SCRIPTS=$DOTFILES/install_scripts

case $1 in
    edit)
        $EDITOR $ROOT/config/$2
    ;;

    add)
        echo "    - $2" >> $ROOT/packages.conf.yaml
    ;;

    install)
        sudo pacman -Sy python --noconfirm

        $SCRIPTS/pre-install

        $SCRIPTS/install-packages

        # if (( $3 == "applications" ))
        # then
        $SCRIPTS/install-applications
        # fi

        $SCRIPTS/post-install
    ;;

    install-server)
        sudo apt install python3 neovim curl zsh -y

        $ROOT/install -c "$DOTFILES/install-server.yaml"
    ;;

    *)
        echo "Commands:"
        echo "  install     installs the dotfiles"
        echo "  edit        edit one of the config files"
        echo "  add         add a package to the list"
    ;;
esac
