1# /usr/share/bash-completion/completions/dscextract 2# Bash command completion for ‘dscextract(1)’. 3# Documentation: ‘bash(1)’, section “Programmable Completion”. 4 5# Copyright © 2015, Nicholas Bamber <nicholas@periapt.co.uk> 6 7_dscextract() 8{ 9 local cur prev words cword _options 10 _init_completion || return 11 12 if [[ "$cur" == -* ]]; then 13 COMPREPLY=( $( compgen -W '-f' -- "$cur" ) ) 14 elif [[ "$prev" == -f ]]; then 15 declare -a _compreply=( $( compgen -o filenames -G '*.dsc' ) ) 16 COMPREPLY=( $( compgen -W "${_compreply[*]}" -- "$cur" ) ) 17 elif [[ "$prev" == *.dsc ]]; then 18 declare -a _compreply=( $( tar tvf ${prev/.dsc/.debian.tar.*} 2>/dev/null | sed 's! \+! !g' | cut -d' ' -f6 ) ) 19 COMPREPLY=( $( compgen -W "${_compreply[*]}" -- "$cur" ) ) 20 else 21 declare -a _compreply=( $( compgen -W '-f' -o filenames -G '*.dsc' ) ) 22 COMPREPLY=( $( compgen -W "${_compreply[*]}" -- "$cur" ) ) 23 fi 24 25 return 0 26} && complete -F _dscextract dscextract 27 28 29# Local variables: 30# coding: utf-8 31# mode: shell-script 32# indent-tabs-mode: nil 33# End: 34# vim: fileencoding=utf-8 filetype=sh expandtab shiftwidth=4 : 35