<commit_before>#!bash
#
# bash completion script for Dart 'hop'
# https://github.com/kevmoo/hop.dart
#
# This script assumes hop.dart/bin/hop is in your path
#

_hop() 
{
  local cur prev opts
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  opts=`hop print_raw_task_list`

  if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
      COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
      return 0
  fi
}
complete -F _hop hop<commit_msg>Handle auto-complete attempts outside a 'hop' directory<commit_after>#!bash
#
# bash completion script for Dart 'hop'
# https://github.com/kevmoo/hop.dart
#
# This script assumes hop.dart/bin/hop is in your path
#

_hop() 
{
  local cur prev opts
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"

  # capture both stdout and stderr
  opts=`hop print_raw_task_list 2>&1`

  # if exit code for `hop` is not 0, then return an error
  # probably not in a directory with tool/hop_runner.dart
  if [ $? -ne 0 ] ; then 
    return 1
  fi

  if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
      COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
      return 0
  fi
}
complete -F _hop hop
{'fraction_non_alphanumeric': 0.15446428571428572, 'fraction_numerical': 0.008035714285714285, 'mean_word_length': 3.198501872659176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '1845661', 'n_tokens_mistral': 435, 'n_tokens_neox': 417, 'n_words': 123}