<commit_before>#!/bin/sh

source "$(dirname $0)/../scripts/common"
cd "$(dirname $0)"/..

identify_os() {
  local OS_NAMES
  OS_NAMES[16]="Sierra"
  OS_NAMES[15]="El Capitan"
  OS_NAMES[14]="Yosemite"
  OS_NAMES[13]="Mavericks"
  OS_NAMES[12]="Mountain Lion"
  OS_NAMES[11]="Lion"
  OS_NAMES[10]="Snow Leopard"
  OS_NAMES[9]="Leopard"
  OS_NAMES[8]="Tiger"
  OS_NAMES[7]="Panther"
  OS_NAMES[6]="Jaguar"
  OS_NAMES[5]="Puma"

  OS_MAJOR_VERSION=$(uname -r | cut -d '.' -f 1)
  OS_NAME=${OS_NAMES[$OS_MAJOR_VERSION]}
}

# On MacOS, install Zsh using Homebrew if OS too old.
if [ "$(uname -s)" == "Darwin" ] ; then
  identify_os
  if [ "$OS_MAJOR_VERSION" -lt 14 ] ; then
    echo "Your OS ($OS_NAME) is too old. Please upgrade."; exit 1
  elif [ "$OS_MAJOR_VERSION" -lt 16 ] ; then
    echo "Your OS ($OS_NAME) is a bit old."
    echo "We will install a recent Zsh using Homebrew."
    brew install zsh
    default_shell="$(brew --prefix)/bin/zsh"
    if ! grep -Fxq "${default_shell}" /etc/shells
    then
      sudo /bin/sh -c "echo ${default_shell} >> /etc/shells"
    fi
  elif [ "$OS_MAJOR_VERSION" -eq 16 ] ; then
    # MacOS Sierra now comes with a recent Zsh (5.2, so we do not need
    # to `brew install zsh` anymore.
    echo "Your OS ($OS_NAME) has a recent Zsh, so we will be using that."
    default_shell="/bin/zsh"
  else
    echo "UNKNOWN OS"; exit 1
  fi
fi

if [ "$SHELL" != "$default_shell" ]; then
  echo "Setting $default_shell as the default shell..."
  chsh -s "$default_shell"
else
  echo "Your default shell is already set to $default_shell"
fi<commit_msg>Use more up-to-date Brew zsh rather than system version.<commit_after>#!/bin/sh

source "$(dirname $0)/../scripts/common"
cd "$(dirname $0)"/..

identify_os() {
  local OS_NAMES
  OS_NAMES[17]="High Sierra"
  OS_NAMES[16]="Sierra"
  OS_NAMES[15]="El Capitan"
  OS_NAMES[14]="Yosemite"
  OS_NAMES[13]="Mavericks"
  OS_NAMES[12]="Mountain Lion"
  OS_NAMES[11]="Lion"
  OS_NAMES[10]="Snow Leopard"
  OS_NAMES[9]="Leopard"
  OS_NAMES[8]="Tiger"
  OS_NAMES[7]="Panther"
  OS_NAMES[6]="Jaguar"
  OS_NAMES[5]="Puma"

  OS_MAJOR_VERSION=$(uname -r | cut -d '.' -f 1)
  OS_NAME=${OS_NAMES[$OS_MAJOR_VERSION]}
}

# On MacOS, install Zsh using Homebrew if OS too old.
if [ "$(uname -s)" == "Darwin" ] ; then
  identify_os
  if [ "$OS_MAJOR_VERSION" -lt 14 ] ; then
    echo "Your OS ($OS_NAME) is too old. Please upgrade."; exit 1
  elif [ "$OS_MAJOR_VERSION" -lt 18 ] ; then
    echo "We will install a recent Zsh using Homebrew."
    brew install zsh
    default_shell="$(brew --prefix)/bin/zsh"
    if ! grep -Fxq "${default_shell}" /etc/shells
    then
      sudo /bin/sh -c "echo ${default_shell} >> /etc/shells"
    fi
  else
    echo "UNKNOWN OS"; exit 1
  fi
fi

if [ "$SHELL" != "$default_shell" ]; then
  echo "Setting $default_shell as the default shell..."
  chsh -s "$default_shell"
else
  echo "Your default shell is already set to $default_shell"
fi
{'fraction_non_alphanumeric': 0.15576005453306066, 'fraction_numerical': 0.021131561008861623, 'mean_word_length': 3.550387596899225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4352155', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1175, 'n_words': 314}