<commit_before>#!/usr/bin/env bash
#
# Prompt configuration
#
# NOTE: Requires colors built-in to be loaded.
autoload -Uz colors; colors

if (( $+commands[git] ))
then
  git_cmd="$commands[git]"
else
  git_cmd="/usr/bin/git"
fi

git_status () {
  # TODO: Resume here: need to determine whether to show dirty/unpushed based on config
  # and short-circuit before the call to git status
  if [ $(git rev-parse --is-inside-work-tree 2>/dev/null) ]; then
    echo " on $(git_dirty)$(git_branch)%{$reset_color%}$(need_push)"
  fi
}

git_branch() {
  echo $(git rev-parse --abbrev-ref HEAD)
}

git_dirty () {
  git_status=$(git status --porcelain)
  if [ -z "$git_status" ]; then
    # Clean
    echo "%{$fg_bold[green]%}"
  else
    # Dirty
    echo "%{$fg_bold[red]%}"
  fi
}

# git_dirty() {
#   st=$(git status 2>/dev/null | tail -n 1)
#   if [[ $st == "" ]]
#   then
#     echo ""
#   else
#     if [[ "$st" =~ ^nothing ]]
#     then
#       echo "on %{$fg_bold[green]%}$(git_branch)%{$reset_color%}"
#     else
#       echo "on %{$fg_bold[red]%}$(git_branch)%{$reset_color%}"
#     fi
#   fi
# }

# git_prompt_info () {
#  ref=$($git_cmd symbolic-ref HEAD 2>/dev/null) || return
#  echo "${ref#refs/heads/}"
# }

unpushed () {
  $(git cherry -v @{upstream} 2>/dev/null)
}

need_push () {
  if [ -z "$(unpushed)" ]; then
    echo ""
  else
    echo " with %{$fg_bold[magenta]%}unpushed%{$reset_color%} "
  fi
}

user_info() {
  echo "%{$fg[green]%}%n@%m%{$reset_color%}"
}

# This keeps the number of todos always available the right hand side of my
# command line. I filter it to only count those tagged as "+next", so it's more
# of a motivation to clear out the list.
todo(){
  if (( $+commands[todo.sh] ))
  then
    num=$(echo $(todo.sh ls +next | wc -l))<commit_msg>WIP: Make refactor . . . y'know . . . work<commit_after>#!/usr/bin/env bash
#
# Prompt configuration
#
# NOTE: Requires colors built-in to be loaded.
autoload -Uz colors; colors

if (( $+commands[git] ))
then
  git_cmd="$commands[git]"
else
  git_cmd="/usr/bin/git"
fi

git_status () {
  # TODO: Resume here: need to determine whether to show dirty/unpushed based on config
  # and short-circuit before the call to git status
  if [ $(git rev-parse --is-inside-work-tree 2>/dev/null) ]; then
    echo " on $(git_dirty_color)$(git_branch)%{$reset_color%}$(need_push)"
  fi
}

git_branch () {
  git rev-parse --abbrev-ref HEAD
}

git_dirty_color () {
  git_status=$(git status --porcelain)
  if [ -z "$git_status" ]; then
    # Clean
    echo "%{$fg_bold[green]%}"
  else
    # Dirty
    echo "%{$fg_bold[red]%}"
  fi
}

# git_dirty() {
#   st=$(git status 2>/dev/null | tail -n 1)
#   if [[ $st == "" ]]
#   then
#     echo ""
#   else
#     if [[ "$st" =~ ^nothing ]]
#     then
#       echo "on %{$fg_bold[green]%}$(git_branch)%{$reset_color%}"
#     else
#       echo "on %{$fg_bold[red]%}$(git_branch)%{$reset_color%}"
#     fi
#   fi
# }

# git_prompt_info () {
#  ref=$($git_cmd symbolic-ref HEAD 2>/dev/null) || return
#  echo "${ref#refs/heads/}"
# }

unpushed () {
  git cherry -v @{upstream} 2>/dev/null
}

need_push () {
  if [ -z "$(unpushed)" ]; then
    echo ""
  else
    echo " with %{$fg_bold[magenta]%}unpushed%{$reset_color%} "
  fi
}

user_info() {
  echo "%{$fg[green]%}%n@%m%{$reset_color%}"
}

# This keeps the number of todos always available the right hand side of my
# command line. I filter it to only count those tagged as "+next", so it's more
# of a motivation to clear out the list.
todo(){
  if (( $+commands[todo.sh] ))
  then
    num=$(echo $(todo.sh ls +next | wc -l))
{'fraction_non_alphanumeric': 0.18639798488664988, 'fraction_numerical': 0.00279876854184159, 'mean_word_length': 3.219598583234947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2076718', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1370, 'n_words': 354}