# Bash completion for ntu (NameToUnix) _ntu_completion() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" # All available options opts="--dry-run --no-changes --quiet --force --exclude --verbose --modify-root --special --help --version -n -q -f -e -v -h -V" # Handle options that require arguments case "${prev}" in -e|--exclude) # Suggest glob patterns COMPREPLY=( $(compgen -W '"*.tmp" "*.log" "*.bak" "*.swp" "*~"' -- ${cur}) ) return 0 ;; *) ;; esac # If current word starts with -, complete with options if [[ ${cur} == -* ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi # Otherwise complete with directories and files COMPREPLY=( $(compgen -f -- ${cur}) ) return 0 } # Register completion function complete -F _ntu_completion ntu