
have wajig &&
_wajig()
{
        local cur prev opt

        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
        prev=${COMP_WORDS[COMP_CWORD-1]}

        if [ "$COMP_CWORD" -ge "2" ]; then
           COMPREPLY=($( compgen -W "$(apt-cache pkgnames "$cur")" -- $cur ) )
        elif [[ "$cur" == -* ]]; then
            COMPREPLY=($( compgen -W '-h --help -q --quiet -n --noauth  \ 
                                  -s --simulate -t --teaching -v  \ 
                                  --verbose -y --yes' -- $cur ) )
        else        
            COMPREPLY=($( compgen -W 'addcdrom auto-alts auto-clean auto-download \ 
            auto-install auto-remove available bug build \ 
            build-depend changelog clean commands contents \ 
            daily-upgrade dependents describe describe-new \ 
            detail detail-new dist-upgrade docs download \ 
            file-download file-install file-remove find-file \ 
            find-pkg fix-configure fix-install fix-missing \ 
            force help hold init info install installr \ 
            installrs installs install integrity large \ 
            last-update list list-all list-alts list-cache \ 
            list-commands list-daemons list-files list-hold \ 
            list-installed list-log list-names list-orphans \ 
            list-scripts list-section list-sections list-status \ 
            list-wide local-dist-upgrade local-upgrade \ 
            locate madison move new news new-upgrades \ 
            non-free orphans package policy purge purge-depend \ 
            purge-orphans readme recursive recommended \ 
            reconfigure reinstall reload remove remove-depend \ 
            remove-orphans repackage reset restart rpm \ 
            rpminstall rpmtodeb search search-apt setup \ 
            show showdistupgrade showinstall showremove \ 
            showupgrade size sizes snapshot source start \ 
            status status-match status-search stop suggested \ 
            tasksel toupgrade unhold unofficial update \ 
            update-alts update-pci-ids update-usb-ids \ 
            upgrade verify version versions whatis whichpkg' -- $cur ) )
        fi

}
[ -n "${have:-}" ] && complete -F _wajig $default wajig
