<commit_before>#!/bin/bash

##################################################
#                    Variables                   #
##################################################
version="0.0.2"
hasDepends=true
gitPath=$(which git 2>&1)
cmakePath=$(which cmake 2>&1)
ninjaPath=$(which ninja 2>&1)
distro=$(sed -n 3p /etc/os-release | sed 's/^...//')
cmakebuilddir=$(pwd)"/build-cmake-$distro"
cpucores=$(grep -c ^processor /proc/cpuinfo)


##################################################
#                    Functions                   #
##################################################
function dependCheck() {
  which git &>/dev/null
  hasGit=$?

  which cmake &>/dev/null
  hasCMake=$?

  which ninja &>/dev/null
  hasNinja=$?

  if [ $hasGit -ne 0 ]; then
    echo "Missing Git"
    hasDepends=false
  else
    echo "Path to Git: $gitPath"
  fi
  if [ $hasCMake -ne 0 ]; then
    echo "Missing CMake"
    hasDepends=false
  else
    echo "Path to CMake: $cmakePath"
  fi
  if [ $hasNinja -ne 0 ]; then
    echo "Missing Ninja"
    hasDepends=false
  else
    echo "Path to Ninja: $ninjaPath"
  fi

}

function generate() {
  mkdir -p "$cmakebuilddir"
  cd "$cmakebuilddir"
  $cmakePath -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DNPM_ENABLE=ON -G Ninja ../
}

function build() {
  cd "$cmakebuilddir"
  $ninjaPath -j$cpucores
}

function clean() {
  rm -rf "$cmakebuilddir"
  #rm -rf main.c
}

function gitAdd() {
  $gitPath add $1
}

function gitCommit() {
  $gitPath commit -am "$@"
}

function gitPush() {
  $gitPath push
}

function cleanAndBuild() {
  echo "Cleaning..."
  clean
  echo "Generating..."
  generate
  echo "Building..."
  build
  exit 0
}

function gitCommitAndPush() {
  echo "Committing..."
  gitCommit "$@"
  echo "Pushing..."
  gitPush
}


##################################################
#                    Arguments                   #
##################################################
if [ $# -le 0 ]; then
  echo "No arguments"
  echo ""
  echo "Use 'help' to list available arguments"
  echo "Exiting..."
  exit 1
fi

if [ $# -eq 1 ]; then
  if [ $1 = "gen" ]; then
    echo 'Generating...'
    generate
    exit 0
  fi
  if [ $1 = "build" ]; then
    echo 'Generating...'
    generate
    echo 'Building...'
    build
    exit 0
  fi
  if [ $1 = "clean" ]; then
    echo "Cleaning..."
    clean
    exit 0
  fi
  if [ $1 = "cab" ]; then
    cleanandbuild
    exit 0
  fi
  if [ $1 = "depends" ]; then
    echo "Checking Dependencies..."
    dependCheck
    if [ $hasDepends = true ]; then
      echo "All dependencies installed"
      exit 0
    else
      echo "Some dependencies are missing."
      echo "See above about which"
      exit 1
    fi
  fi
  if [ $1 = "push" ]; then
    echo "Pushing..."
    gitPush
    exit 0
  fi
  if [ $1 = "help" ]; then<commit_msg>Fix more typos<commit_after>#!/bin/bash

##################################################
#                    Variables                   #
##################################################
version="0.0.1"
hasDepends=true
gitPath=$(which git 2>&1)
cmakePath=$(which cmake 2>&1)
ninjaPath=$(which ninja 2>&1)
distro=$(sed -n 3p /etc/os-release | sed 's/^...//')
cmakebuilddir=$(pwd)"/build-cmake-$distro"
cpucores=$(grep -c ^processor /proc/cpuinfo)


##################################################
#                    Functions                   #
##################################################
function dependCheck() {
  which git &>/dev/null
  hasGit=$?

  which cmake &>/dev/null
  hasCMake=$?

  which ninja &>/dev/null
  hasNinja=$?

  if [ $hasGit -ne 0 ]; then
    echo "Missing Git"
    hasDepends=false
  else
    echo "Path to Git: $gitPath"
  fi
  if [ $hasCMake -ne 0 ]; then
    echo "Missing CMake"
    hasDepends=false
  else
    echo "Path to CMake: $cmakePath"
  fi
  if [ $hasNinja -ne 0 ]; then
    echo "Missing Ninja"
    hasDepends=false
  else
    echo "Path to Ninja: $ninjaPath"
  fi

}

function generate() {
  mkdir -p "$cmakebuilddir"
  cd "$cmakebuilddir"
  $cmakePath -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DNPM_ENABLE=ON -G Ninja ../
}

function build() {
  cd "$cmakebuilddir"
  $ninjaPath -j$cpucores
}

function clean() {
  rm -rf "$cmakebuilddir"
  #rm -rf main.c
}

function gitAdd() {
  $gitPath add $1
}

function gitCommit() {
  $gitPath commit -am "$@"
}

function gitPush() {
  $gitPath push
}

function cleanAndBuild() {
  echo "Cleaning..."
  clean
  echo "Generating..."
  generate
  echo "Building..."
  build
  exit 0
}

function gitCommitAndPush() {
  echo "Committing..."
  gitCommit "$@"
  echo "Pushing..."
  gitPush
}


##################################################
#                    Arguments                   #
##################################################
if [ $# -le 0 ]; then
  echo "No arguments"
  echo ""
  echo "Use 'help' to list available arguments"
  echo "Exiting..."
  exit 1
fi

if [ $# -eq 1 ]; then
  if [ $1 = "gen" ]; then
    echo 'Generating...'
    generate
    exit 0
  fi
  if [ $1 = "build" ]; then
    echo 'Generating...'
    generate
    echo 'Building...'
    build
    exit 0
  fi
  if [ $1 = "clean" ]; then
    echo "Cleaning..."
    clean
    exit 0
  fi
  if [ $1 = "cab" ]; then
    cleanAndBuild
    exit 0
  fi
  if [ $1 = "depends" ]; then
    echo "Checking Dependencies..."
    dependCheck
    if [ $hasDepends = true ]; then
      echo "All dependencies installed"
      exit 0
    else
      echo "Some dependencies are missing."
      echo "See above about which"
      exit 1
    fi
  fi
  if [ $1 = "push" ]; then
    echo "Pushing..."
    gitPush
    exit 0
  fi
  if [ $1 = "help" ]; then
{'fraction_non_alphanumeric': 0.2315123836290181, 'fraction_numerical': 0.011241875988055507, 'mean_word_length': 2.5256965944272447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2569751', 'n_tokens_mistral': 1984, 'n_tokens_neox': 1883, 'n_words': 525}