1#!/usr/bin/env bash
2_tqdm(){
3  local cur prv
4  cur="${COMP_WORDS[COMP_CWORD]}"
5  prv="${COMP_WORDS[COMP_CWORD - 1]}"
6
7  case ${prv} in
8  --bar_format|--buf_size|--colour|--comppath|--delay|--delim|--desc|--initial|--lock_args|--manpath|--maxinterval|--mininterval|--miniters|--ncols|--nrows|--position|--postfix|--smoothing|--total|--unit|--unit_divisor)
9    # await user input
10    ;;
11  "--log")
12    COMPREPLY=($(compgen -W       'CRITICAL FATAL ERROR WARN WARNING INFO DEBUG NOTSET' -- ${cur}))
13    ;;
14  *)
15    COMPREPLY=($(compgen -W '--ascii --bar_format --buf_size --bytes --colour --comppath --delay --delim --desc --disable --dynamic_ncols --help --initial --leave --lock_args --log --manpath --maxinterval --mininterval --miniters --ncols --nrows --null --position --postfix --smoothing --tee --total --unit --unit_divisor --unit_scale --update --update_to --version --write_bytes -h -v' -- ${cur}))
16    ;;
17  esac
18}
19complete -F _tqdm tqdm
20