# AUTOMATICALLY GENERATED by `shtab`



_shtab_git_fame_option_strings=('-h' '--help' '-e' '--show-email' '--format' '-C' '-C' '-t' '--bytype' '--ignore-revs-file' '--since' '--auth' '--ignore-rev' '--min' '-v' '--version' '-M' '-M' '--warn-binary' '--excl' '-s' '--silent-progress' '-w' '--ignore-whitespace' '--sort' '--log' '-j' '--jobs' '--show' '--cost' '--loc' '-n' '--no-regex' '-R' '--recurse' '--branch' '--enum' '--incl' '--until' '--print-completion')



_shtab_git_fame___format_choices=('yaml' 'yml' 'json' 'csv' 'tsv' 'svg' 'md' 'markdown' 'tabulate' 'simple' 'plain' 'grid' 'simple_grid' 'rounded_grid' 'heavy_grid' 'mixed_grid' 'double_grid' 'fancy_grid' 'colon_grid' 'outline' 'simple_outline' 'rounded_outline' 'heavy_outline' 'mixed_outline' 'double_outline' 'fancy_outline' 'github' 'pipe' 'orgtbl' 'jira' 'presto' 'pretty' 'psql' 'rst' 'mediawiki' 'moinmoin' 'youtrack' 'html' 'unsafehtml' 'latex' 'latex_raw' 'latex_booktabs' 'latex_longtable' 'tsv' 'textile' 'asciidoc' 'fame' 'svg-simple' 'svg-plain' 'svg-grid' 'svg-simple_grid' 'svg-rounded_grid' 'svg-heavy_grid' 'svg-mixed_grid' 'svg-double_grid' 'svg-fancy_grid' 'svg-colon_grid' 'svg-outline' 'svg-simple_outline' 'svg-rounded_outline' 'svg-heavy_outline' 'svg-mixed_outline' 'svg-double_outline' 'svg-fancy_outline' 'svg-github' 'svg-pipe' 'svg-orgtbl' 'svg-presto' 'svg-pretty' 'svg-psql' 'svg-rst' 'svg-fame')
_shtab_git_fame___auth_choices=('git' 'first' 'share')
_shtab_git_fame___sort_choices=('loc' 'commits' 'files' 'hours' 'months')
_shtab_git_fame___log_choices=('FATAL' 'CRITICAL' 'ERROR' 'WARNING' 'INFO' 'DEBUG' 'NOTSET')
_shtab_git_fame___show_choices=('name,e' 'email,name' 'email' 'email,n' 'e' 'name' 'n,email' 'e,name' 'n,e' 'e,n' 'name,email' 'n')
_shtab_git_fame___cost_choices=('months,author' 'author,months' 'cocomo,hours' 'commit' 'cocomo' 'hours,months' 'authors,month' 'months,hours' 'cocomo,author' 'hour,months' 'cocomo,commits' 'cocomo,authors' 'months,authors' 'commits' 'hours,cocomo' 'hours,month' 'hour,cocomo' 'month,commits' 'month' 'author,cocomo' 'authors,months' 'hour,month' 'month,commit' 'authors' 'months,commits' 'months' 'cocomo,commit' 'commits,cocomo' 'month,hours' 'cocomo,hour' 'author,month' 'month,hour' 'author' 'commit,month' 'commit,months' 'commits,month' 'months,commit' 'authors,cocomo' 'commits,months' 'month,authors' 'months,hour' 'month,author' 'hour' 'commit,cocomo' 'hours')
_shtab_git_fame___loc_choices=('-,insertions' '-' 'deletions,add' 'delete,additions' '+,-' 'del,insertion' 'insert,delete' 'survive' 'ins,delete' '+,del' 'delete' 'additions' 'addition,-' 'deletions,additions' 'del,add' '-,+' 'deletion' 'ins' 'insertions,del' 'deletions,+' 'insertions,deletion' 'del,ins' '+' 'delete,insert' 'add,del' 'insertion,deletions' 'delete,addition' 'deletions,insertions' '-,insert' 'deletion,addition' 'surv' 'add' 'deletion,insertion' 'insert,del' 'additions,del' 'del,+' 'deletions,insert' 'insert' 'add,deletions' 'ins,deletions' 'ins,deletion' 'additions,delete' 'insertions,-' 'addition,del' '+,delete' 'insertion' 'delete,ins' 'addition,delete' 'add,-' 'insertion,deletion' 'additions,-' 'deletions,insertion' 'deletions,ins' 'del,additions' 'surviving' 'del' 'insertions,deletions' 'deletion,insert' 'addition,deletions' '-,additions' 'additions,deletion' 'insertion,del' 'delete,add' '-,insertion' 'insertions,delete' 'deletion,+' 'del,addition' 'deletions,addition' 'additions,deletions' 'delete,+' 'del,insertions' 'insertion,delete' 'insertion,-' 'add,deletion' 'del,insert' 'delete,insertions' '+,deletions' 'deletions' 'insertions' '-,addition' 'insert,deletions' '-,add' 'deletion,add' 'deletion,additions' 'delete,insertion' 'deletion,insertions' 'ins,-' 'addition,deletion' 'addition' 'insert,deletion' '+,deletion' 'ins,del' 'insert,-' 'deletion,ins' '-,ins' 'add,delete')
_shtab_git_fame___print_completion_choices=('bash' 'zsh' 'tcsh')

_shtab_git_fame_pos_0_nargs=*
_shtab_git_fame__h_nargs=0
_shtab_git_fame___help_nargs=0
_shtab_git_fame__e_nargs=0
_shtab_git_fame___show_email_nargs=0
_shtab_git_fame__C_nargs=0
_shtab_git_fame__C_nargs=0
_shtab_git_fame__t_nargs=0
_shtab_git_fame___bytype_nargs=0
_shtab_git_fame__v_nargs=0
_shtab_git_fame___version_nargs=0
_shtab_git_fame__M_nargs=0
_shtab_git_fame__M_nargs=0
_shtab_git_fame___warn_binary_nargs=0
_shtab_git_fame__s_nargs=0
_shtab_git_fame___silent_progress_nargs=0
_shtab_git_fame__w_nargs=0
_shtab_git_fame___ignore_whitespace_nargs=0
_shtab_git_fame__n_nargs=0
_shtab_git_fame___no_regex_nargs=0
_shtab_git_fame__R_nargs=0
_shtab_git_fame___recurse_nargs=0
_shtab_git_fame___enum_nargs=0


# $1=COMP_WORDS[1]
_shtab_compgen_files() {
  compgen -f -- $1  # files
}

# $1=COMP_WORDS[1]
_shtab_compgen_dirs() {
  compgen -d -- $1  # recurse into subdirs
}

# $1=COMP_WORDS[1]
_shtab_replace_nonword() {
  echo "${1//[^[:word:]]/_}"
}

# set default values (called for the initial parser & any subparsers)
_set_parser_defaults() {
  local subparsers_var="${prefix}_subparsers[@]"
  sub_parsers=${!subparsers_var-}

  local current_option_strings_var="${prefix}_option_strings[@]"
  current_option_strings=${!current_option_strings_var}

  completed_positional_actions=0

  _set_new_action "pos_${completed_positional_actions}" true
}

# $1=action identifier
# $2=positional action (bool)
# set all identifiers for an action's parameters
_set_new_action() {
  current_action="${prefix}_$(_shtab_replace_nonword $1)"

  local current_action_compgen_var=${current_action}_COMPGEN
  current_action_compgen="${!current_action_compgen_var-}"

  local current_action_choices_var="${current_action}_choices[@]"
  current_action_choices="${!current_action_choices_var-}"

  local current_action_nargs_var="${current_action}_nargs"
  if [ -n "${!current_action_nargs_var-}" ]; then
    current_action_nargs="${!current_action_nargs_var}"
  else
    current_action_nargs=1
  fi

  current_action_args_start_index=$(( $word_index + 1 - $pos_only ))

  current_action_is_positional=$2
}

# Notes:
# `COMPREPLY`: what will be rendered after completion is triggered
# `completing_word`: currently typed word to generate completions for
# `${!var}`: evaluates the content of `var` and expand its content as a variable
#     hello="world"
#     x="hello"
#     ${!x} -> ${hello} -> "world"
_shtab_git_fame() {
  local completing_word="${COMP_WORDS[COMP_CWORD]}"
  local previous_word="${COMP_WORDS[COMP_CWORD-1]}"
  local completed_positional_actions
  local current_action
  local current_action_args_start_index
  local current_action_choices
  local current_action_compgen
  local current_action_is_positional
  local current_action_nargs
  local current_option_strings
  local sub_parsers
  COMPREPLY=()

  local prefix=_shtab_git_fame
  local word_index=0
  local pos_only=0 # "--" delimeter not encountered yet
  _set_parser_defaults
  word_index=1

  # determine what arguments are appropriate for the current state
  # of the arg parser
  while [ $word_index -ne $COMP_CWORD ]; do
    local this_word="${COMP_WORDS[$word_index]}"

    if [[ $pos_only = 1 || " $this_word " != " -- " ]]; then
      if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then
        # valid subcommand: add it to the prefix & reset the current action
        prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
        _set_parser_defaults
      fi

      if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then
        # a new action should be acquired (due to recognised option string or
        # no more input expected from current action);
        # the next positional action can fill in here
        _set_new_action $this_word false
      fi

      if [[ "$current_action_nargs" != "*" ]] && \
         [[ "$current_action_nargs" != "+" ]] && \
         [[ "$current_action_nargs" != "?" ]] && \
         [[ "$current_action_nargs" != *"..." ]] && \
         (( $word_index + 1 - $current_action_args_start_index - $pos_only >= \
            $current_action_nargs )); then
        $current_action_is_positional && let "completed_positional_actions += 1"
        _set_new_action "pos_${completed_positional_actions}" true
      fi
    else
      pos_only=1 # "--" delimeter encountered
    fi

    let "word_index+=1"
  done

  # Generate the completions

  if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
    # optional argument started: use option strings
    COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
  elif [[ "${previous_word}" == ">" || "${previous_word}" == ">>" ||
          "${previous_word}" =~ ^[12]">" || "${previous_word}" =~ ^[12]">>" ]]; then
    # handle redirection operators
    COMPREPLY=( $(compgen -f -- "${completing_word}") )
  else
    # use choices & compgen
    local IFS=$'\n' # items may contain spaces, so delimit using newline
    COMPREPLY=( $([ -n "${current_action_compgen}" ] \
                  && "${current_action_compgen}" "${completing_word}") )
    unset IFS
    COMPREPLY+=( $(compgen -W "${current_action_choices[*]}" -- "${completing_word}") )
  fi

  return 0
}

complete -o filenames -F _shtab_git_fame git-fame
