#!/bin/bash _tiempo () { cur="${COMP_WORDS[COMP_CWORD]}" cmd="${COMP_WORDS[1]}" if [[ ( $cmd = s* || $cmd = d* || $cmd = k* ) && "$COMP_CWORD" = 2 ]]; then COMPREPLY=($(compgen -W "$(t l --all --flat)" $cur)) return elif [[ "$COMP_CWORD" = 1 ]]; then CMDS="archive backend configure display edit in kill list now out resume sheet week month" COMPREPLY=($(compgen -W "$CMDS" $cur)) fi } complete -F _tiempo 't'