logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).


L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT → ODT PDF Export

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision Les deux révisions suivantes
doc:systeme:apt:apt [05/08/2016 22:54]
bruno-legrand [Mettre à jour la liste des paquets]
doc:systeme:apt:apt [10/10/2016 08:27]
MicP [Astuce : ajouter l'autocompletion pour Debian 8]
Ligne 167: Ligne 167:
 _apt() _apt()
 { {
 +    local sourcesdir="/​etc/​apt/​sources.list.d"​
     local cur prev words cword     local cur prev words cword
     _init_completion || return     _init_completion || return
  
-    local special ​i+    ​# see if the user selected a command already 
 +    ​local COMMANDS=( 
 +        "​list"​ 
 +        "​search"​ 
 +        "​show"​ 
 +        "​install"​ "​remove"​ "​purge"​ "​autoremove"​ 
 +        "​update"​ 
 +        "​upgrade"​ "​full-upgrade"​ "​dist-upgrade"​ 
 +        "​edit-sources"​ 
 +        "​help"​) 
 + 
 +    local command ​i
     for (( i=0; i < ${#​words[@]}-1;​ i++ )); do     for (( i=0; i < ${#​words[@]}-1;​ i++ )); do
-        if [[ ${words[i]} ​== @(list|search|show|update|install|remove|upgrade|full-upgrade|edit-sources|dist-upgrade|purge) ​]]; then +        if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then 
-            ​special=${words[i]}+            ​command=${words[i]} 
 +            break
         fi         fi
     done     done
  
-    if [[ -n $special ​]]; then +    ​# supported options per command 
-        case $special ​in +    if [[ "​$cur"​ == -* ]]; then 
-            remove|purge)+        case $command in 
 +            install|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove) 
 +                COMPREPLY=( $( compgen -W '​--show-progress 
 +                  --fix-broken --purge --verbose-versions --auto-remove 
 +                  --simulate --dry-run 
 +                  --download 
 +                  --fix-missing 
 +                  --fix-policy 
 +                  --ignore-hold 
 +                  --force-yes 
 +                  --trivial-only 
 +                  --reinstall --solver'​ -- "​$cur"​ ) ) 
 +                return 0 
 +                ;; 
 +            update) 
 +                COMPREPLY=( $( compgen -W '​--list-cleanup  
 +                  ' -- "​$cur"​ ) ) 
 +                return 0 
 +                ;; 
 +            list) 
 +                COMPREPLY=( $( compgen -W '​--installed --upgradable  
 +                  --manual-installed 
 +                  -v --verbose 
 +                  -a --all-versions 
 +                   '​ -- "​$cur"​ ) ) 
 +                return 0 
 +                ;; 
 +            show) 
 +                COMPREPLY=( $( compgen -W '-a --all-versions 
 +                  ' -- "​$cur"​ ) ) 
 +                return 0 
 +                ;; 
 +        esac 
 +    fi 
 + 
 +    # specific command arguments 
 +    ​if [[ -n $command ​]]; then 
 +        case $command ​in 
 +            remove|purge|autoremove)
                 if [[ -f /​etc/​debian_version ]]; then                 if [[ -f /​etc/​debian_version ]]; then
                     # Debian system                     # Debian system
Ligne 190: Ligne 241:
                 return 0                 return 0
                 ;;                 ;;
-            ​*)+            ​show|list)
                 COMPREPLY=( $( apt-cache --no-generate pkgnames "​$cur"​ \                 COMPREPLY=( $( apt-cache --no-generate pkgnames "​$cur"​ \
                     2> /dev/null ) )                     2> /dev/null ) )
 +                return 0
 +                ;;
 +            install)
 +                COMPREPLY=( $( apt-cache --no-generate pkgnames "​$cur"​ \
 +                    2> /dev/null ) )
 +                _filedir "​*.deb"​
 +                return 0
 +                ;;
 +            edit-sources)
 +                COMPREPLY=( $( compgen -W '$( command ls $sourcesdir )' \
 +                    -- "​$cur"​ ) )
                 return 0                 return 0
                 ;;                 ;;
Ligne 198: Ligne 260:
     fi     fi
  
-    ​case $prev in +    ​# no command ​yetshow what commands we have 
-        -c|--config-file) +    if [ "$command" = "" ​]; then 
-             ​_filedir +        COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "​$cur"​ ) )
-             ​return 0 +
-             ;; +
-        -t|--target-release|--default-release) +
-             ​COMPREPLY=( $( apt-cache policy | \ +
-                 command ​grep "​release.o=Debian,a=$cur"​ | \ +
-                 sed -e "​s/​.*a=\(\w*\).*/​\1/"​ | uniq 2> /dev/null) ) +
-             ​return 0 +
-             ;; +
-    esac +
- +
-    if [[ "$cur" == -* ]]; then +
-        COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o +
-            --download-only --fix-broken --help --version --ignore-missing +
-            --fix-missing --no-download --quiet --simulate --just-print +
-            --dry-run --recon --no-act --yes --assume-yes --show-upgraded +
-            --only-source --compile --build --ignore-hold --target-release +
-            --no-upgrade --force-yes --print-uris --purge --reinstall +
-            --list-cleanup --default-release --trivial-only --no-remove +
-            --diff-only --no-install-recommends --tar-only --config-file +
-            --option --auto-remove'​ -- "$cur" ) ) +
-    else +
-        COMPREPLY=( $( compgen -W 'list search show update install  +
-            remove upgrade full-upgrade edit-sources dist-upgrade  +
-            purge' -- "​$cur"​ ) )+
     fi     fi
  
doc/systeme/apt/apt.txt · Dernière modification: 24/11/2023 21:13 par vv222

Pied de page des forums

Propulsé par FluxBB