<commit_before>#!/bin/sh

dotfiles () {
    ##########
    # This function is based on a blogpost by <NAME>
    # http://blog.smalleycreative.com/tutorials/using-git-and-github-to-manage-your-dotfiles/
    #
    # This function creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
    #
    # Modifications by <NAME> (github.com/ErikBjare) 
    # Modifications by <NAME> (github.com/johan-bjareholt)
    ##########

    # Variables
    cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    dir=$cwd/home                    # files will symlink to ~/
    backup=$cwd/backup               # old dotfiles backup directory

    # files="zshrc config/awesome oh-my-zsh Xdefaults vimrc xmonad"   # list of files/folders to symlink in homedir
    files=$( cd $dir && find ./ -maxdepth 1 -mindepth 1 )

    # create dotfiles_old in homedir
    echo "Creating $backup for backup of any existing dotfiles"
    mkdir -p $backup
    echo "...done"

    # change to the dotfiles directory
    echo "Changing to the $dir directory"
    cd $dir
    echo "...done"

    # move any existing dotfiles (excluding symlinks) in homedir to dotfiles_old directory, then create symlinks
    for file in $files; do
        if [ -e ~/$file ]; then 
            if [ ! -h ~/$file ]; then
                echo "Collision: Moving existing ~/$file to $backup"
                mv ~/$file $backup
            else
                echo "Symlink ~/$file already existed"
            fi
	fi
        if [ ! -h ~/$file ]; then
            echo "Creating symlink to $file in home directory."
            ln -si $dir/$file ~/$file
        fi
    done
    cd $cwd
}

echo Welcome to my linux config setup script!

for section in dotfiles; do
    echo "Would you like to setup $section? (y/n): "
    read prompt
    echo
    if [ $prompt = y ]; then
        `echo $section`
    fi
done

echo "Done!"<commit_msg>Lots of improvements to setup script<commit_after>#!/bin/bash

dotfiles () {
    ##########
    # This function is based on a blogpost by <NAME>
    # http://blog.smalleycreative.com/tutorials/using-git-and-github-to-manage-your-dotfiles/
    #
    # This function creates symlinks for all files/dirs in the ./home directory to ~/ and backs up any files/dirs that collide to ./backup
    #
    # Modifications by <NAME> (github.com/ErikBjare)
    #  - Made so that it automatically symlinks all files/dirs in ./home
    #  - Improved output and added color
    # Modifications by <NAME> (github.com/johan-bjareholt)
    ##########

    # Variables
    cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    dir=$cwd/home                    # files will symlink to ~/
    backup=$cwd/backup               # old dotfiles backup directory

    # files="zshrc config/awesome oh-my-zsh Xdefaults vimrc xmonad"   # list of files/folders to symlink in homedir
    files=$( cd $dir && find ./ -maxdepth 1 -mindepth 1 )

    # create dotfiles_old in homedir
    # echo "Creating $backup for backup of any existing dotfiles"
    mkdir -p $backup
    # echo "...done"

    # change to the dotfiles directory
    # echo "Changing to the $dir directory"
    cd $dir
    # echo "...done"

    # move any existing dotfiles (excluding symlinks) in homedir to dotfiles_old directory, then create symlinks
    RED="\e[0;31m"
    YELLOW="\e[0;33m"
    GREEN="\e[0;32m"

    for file in $files; do
        if [ -e ~/$file ]; then 
            if [ ! -h ~/$file ]; then
                echo -e "${RED}Collision: Moving existing ~/${file:2} to $backup"
                mv ~/$file $backup
            else
                echo -e "${YELLOW}Symlink already existed at ~/${file:2}"
            fi
	fi
        if [ ! -h ~/$file ]; then
            echo -e "${GREEN}Creating symlink to ${file:2}"
            ln -si $dir/$file ~/$file
        fi
    done
    cd $cwd
}

echo Welcome to my linux config setup script!

for section in dotfiles; do
    echo -ne "Would you like to setup $section? (y/n): "
    read prompt
    if [ $prompt = y ]; then
        `echo $section`
    fi
done

NC="\e[0m"  # No color
echo -e "${NC}Done!"
{'fraction_non_alphanumeric': 0.12320428536644752, 'fraction_numerical': 0.004626247869491113, 'mean_word_length': 2.1454823889739663, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3412429', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1283, 'n_words': 440}