<commit_before>#!/bin/bash 

wd=${PWD##*/}
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
RED="\033[0;31m"
COLORRESET="\033[0m"
SPACER="   "

function install() { 
  backupall=false
  deleteall=false
  skipall=false
  backupdir=${PWD}/backup

  for file in *.symlink; do
    target="$HOME/.${file%.*}" 
    
    if [ "`readlink $target`" ==  "${PWD}/$file" ]; then
      continue
      fi

    if [ -e "$target" ]; then
      if $backupall ; then
        echo -e "$SPACER$YELLOW-$COLORRESET moving $target to backup"
        mv $target $backupdir
        echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
        ln -s ${PWD}/$file $target
      elif $deleteall ; then
        echo -e "$SPACER$RED-$COLORRESET deleting existing $target"
        rm -r $target
        echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
        ln -s ${PWD}/$file $target
      elif $skipall ; then
        echo -e "$SPACER$YELLOW-$COLORRESET skipping ${file%.*}"
      else
        echo "$target exists. What to do? (b)ackup, (d)elete, (s)kip. Or for this and further existing files (B)ackup, (S)kip, (D)elete"
        read filedecision
        case $filedecision in
         b)
           echo -e "$SPACER$YELLOW-$COLORRESET moving $target to .dotfiles/backup/.$file"
           mv $target $backupdir
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         B)
           echo backup all
           backupall=true
           echo -e "$SPACER$YELLOW-$COLORRESET moving $target to .dotfiles/backup/.$file"
           mv $target $backupdir
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         d)
           echo -e "$SPACER$RED-$COLORRESET deleting $target"
           rm -r $target
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         D)
           echo deleting all
           deleteall=true
           echo -e "$SPACER$RED-$COLORRESET deleting $target"
           rm -r $target
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         s)
           echo -e "$SPACER$YELLOW-$COLORRESET skipping ${file%.*}"
           continue
           ;;
         S)
           echo skipping all
           skipall=true
           echo -e "$SPACER$YELLOW-$COLORRESET skipping ${file%.*}"
           continue
           ;;
         *)
           echo wrong input, skipping
           continue
           ;;
       esac
      fi
      
    else 
      echo linking $file to $target
    fi
  done<commit_msg>fixed folder backup error colored output for new file symlink<commit_after>#!/bin/bash 

wd=${PWD##*/}
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
RED="\033[0;31m"
COLORRESET="\033[0m"
SPACER="   "

function install() { 
  backupall=false
  deleteall=false
  skipall=false
  backupdir=${PWD}/backup

  for file in *.symlink; do
    target="$HOME/.${file%.*}" 
    
    if [ "`readlink $target`" ==  "${PWD}/$file" ]; then
      continue
      fi

    if [ -e "$target" ]; then
      if $backupall ; then
        echo -e "$SPACER$YELLOW-$COLORRESET moving $target to backup"
        mv $target $backupdir/
        echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
        ln -s ${PWD}/$file $target
      elif $deleteall ; then
        echo -e "$SPACER$RED-$COLORRESET deleting existing $target"
        rm -r $target
        echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
        ln -s ${PWD}/$file $target
      elif $skipall ; then
        echo -e "$SPACER$YELLOW-$COLORRESET skipping ${file%.*}"
      else
        echo "$target exists. What to do? (b)ackup, (d)elete, (s)kip. Or for this and further existing files (B)ackup, (S)kip, (D)elete"
        read filedecision
        case $filedecision in
         b)
           echo -e "$SPACER$YELLOW-$COLORRESET moving $target to .dotfiles/backup/.$file"
           mv $target $backupdir/
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         B)
           echo backup all
           backupall=true
           echo -e "$SPACER$YELLOW-$COLORRESET moving $target to .dotfiles/backup/.$file"
           mv $target $backupdir/
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         d)
           echo -e "$SPACER$RED-$COLORRESET deleting $target"
           rm -r $target
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         D)
           echo deleting all
           deleteall=true
           echo -e "$SPACER$RED-$COLORRESET deleting $target"
           rm -r $target
           echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
           ln -s ${PWD}/$file $target
           ;;
         s)
           echo -e "$SPACER$YELLOW-$COLORRESET skipping ${file%.*}"
           continue
           ;;
         S)
           echo skipping all
           skipall=true
           echo -e "$SPACER$YELLOW-$COLORRESET skipping ${file%.*}"
           continue
           ;;
         *)
           echo wrong input, skipping
           continue
           ;;
       esac
      fi
      
    else 
      echo -e "$SPACER$GREEN+$COLORRESET linking $file to $target"
    fi
  done
{'fraction_non_alphanumeric': 0.13070463672873311, 'fraction_numerical': 0.008032128514056224, 'mean_word_length': 1.795408163265306, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2670744', 'n_tokens_mistral': 1838, 'n_tokens_neox': 1693, 'n_words': 480}