<commit_before>#!/usr/bin/env bash

_mainScript_() {

  template="${HOME}/dotfiles/scripting/scriptTemplate.sh"
  [ ! -f "$template" ] \
    && {
      error "Can not find script template expected at '$template'"
      _safeExit_
    }

  [ ${#args[@]} -eq 0 ] && error "No script name specified"

  _errorChecks_() {

    [ -e "${1}" ] \
      && {
        warning "'${1}' already exists."
        return 1
      }
    return 0
  }

  _addExtension_() {
    case "${1}" in
      *.*)
        echo "$1"
        return 0
        ;;
    esac

    echo "${1}.sh"
  }

  for a in "${args[@]}"; do
    a="$(_addExtension_ "$a")"

    if ! _errorChecks_ "$a"; then
      break
    fi
    _execute_ -s "cp \"$template\" \"$a\"; chmod a+x \"$a\"" "Created '${a}'"
  done

} # end _mainScript_

_sourceHelperFiles_() {
  local filesToSource
  local sourceFile
  filesToSource=(
    "${HOME}/dotfiles/scripting/helpers/baseHelpers.bash"
    "${HOME}/dotfiles/scripting/helpers/files.bash"
  )
  for sourceFile in "${filesToSource[@]}"; do
    [ ! -f "$sourceFile" ] \
      && {
        echo "error: Can not find sourcefile '$sourceFile'."
        echo "exiting..."
        exit 1
      }
    source "$sourceFile"
  done
}
_sourceHelperFiles_

# Set Flags
quiet=false
printLog=false
logErrors=false
verbose=false
force=false
dryrun=false
args=()<commit_msg>open new script in editor<commit_after>#!/usr/bin/env bash

_mainScript_() {

  template="${HOME}/dotfiles/scripting/scriptTemplate.sh"
  [ ! -f "$template" ] \
    && {
      error "Can not find script template expected at '$template'"
      _safeExit_
    }

  [ ${#args[@]} -eq 0 ] && error "No script name specified"

  _errorChecks_() {

    [ -e "${1}" ] \
      && {
        warning "'${1}' already exists."
        return 1
      }
    return 0
  }

  _addExtension_() {
    case "${1}" in
      *.*)
        echo "$1"
        return 0
        ;;
    esac

    echo "${1}.sh"
  }

  for a in "${args[@]}"; do
    a="$(_addExtension_ "$a")"

    if ! _errorChecks_ "$a"; then
      break
    fi
    _execute_ -s "cp \"${template}\" \"${a}\"; chmod a+x \"${a}\"" "Created '${a}'"
    "${EDITOR}" "${a}"
  done

} # end _mainScript_

_sourceHelperFiles_() {
  local filesToSource
  local sourceFile
  filesToSource=(
    "${HOME}/dotfiles/scripting/helpers/baseHelpers.bash"
    "${HOME}/dotfiles/scripting/helpers/files.bash"
  )
  for sourceFile in "${filesToSource[@]}"; do
    [ ! -f "$sourceFile" ] \
      && {
        echo "error: Can not find sourcefile '$sourceFile'."
        echo "exiting..."
        exit 1
      }
    source "$sourceFile"
  done
}
_sourceHelperFiles_

# Set Flags
quiet=false
printLog=false
logErrors=false
verbose=false
force=false
dryrun=false
args=()
{'fraction_non_alphanumeric': 0.17111517367458867, 'fraction_numerical': 0.007312614259597806, 'mean_word_length': 2.3819530284301607, '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': '3550192', 'n_tokens_mistral': 979, 'n_tokens_neox': 945, 'n_words': 227}