#!/bin/bash # dpkg-deb(1) bash completion # # Copyright © 2002 Laurent Martelli # Copyright © 2002 Chris Lawrence # Copyright © 2002-2004 Ian Macdonald # Copyright © 2002 Rafael Sepúlveda # Copyright © 2002 Guillaume Rousse # Copyright © 2004 Philipp Weis # Copyright © 2004 Itay Ben-Yaacov # Copyright © 2008-2011 David Paleino # Copyright © 2009-2026 Ville Skyttä # Copyright © 2013 Igor Murzov # Copyright © 2015 Andrea Dari # Copyright © 2018 Uwe Storbeck # Copyright © 2018 Luca Capello # Copyright © 2018 Gabriel F. T. Gomes # Copyright © 2021-2023 Koichi Murase # Copyright © 2024 Arnaud Rebillout # Copyright © 2026 Guillem Jover # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . _comp_cmd_dpkg_deb() { local cur prev words cword was_split _comp_initialize -s -- "$@" || return local i=$cword # Find the last option flag. if [[ $cur != -* ]]; then while [[ $prev != -* && $i -ne 1 ]]; do prev=${words[--i - 1]} done fi local debformats=( 0.939000 2.0 ) local debcompression=( gzip none xz zstd ) local debcompstrategy=( extreme filtered fixed huffman none rle ) local noargopts='!(-*|*[bcIWfexXRvDzZS]*)' # shellcheck disable=SC2254 case $prev in --contents | \ --info | \ --show | \ --ctrl-tarfile | \ --fsys-tarfile | \ --field | \ --control | \ --extract | \ --vextract | \ --raw-extract | \ -${noargopts}[cIWfexXR]) _comp_compgen_filedir '?(u|d)deb' return ;; --build | \ -${noargopts}b) _comp_compgen_filedir -d return ;; --deb-format) _comp_compgen -- -W "${debformats[*]}" return ;; --compression | -Z) _comp_compgen -- -W "${debcompression[*]}" return ;; --compression-level | -z) _comp_compgen -- -W "$(seq 0 22)" return ;; --compression-strategy | -S) _comp_compgen -- -W "${debcompstrategy[*]}" return ;; --threads-max) local nproc # Most Unices. : ${nproc:=$(getconf _NPROCESSORS_ONLN 2>/dev/null)} # Fallback for at least Irix. : ${nproc:=$(getconf _NPROC_ONLN 2>/dev/null)} _comp_compgen -- -W "$(seq 1 "${nproc:-1}")" return ;; esac [[ $was_split ]] && return _comp_compgen_help [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } && complete -F _comp_cmd_dpkg_deb dpkg-deb