.local/share/bash-completion/completions/wsl
changeset 1035 1c38c02cfe9e
equal deleted inserted replaced
1034:7353d0eeff27 1035:1c38c02cfe9e
       
     1 # -*- mode: sh; sh-shell-file: bash -*-
       
     2 
       
     3 _wsl() {
       
     4   local tasks='--help          (Display usage information)
       
     5 --debug-shell         (Open a WSL2 debug shell for diagnostics purposes)
       
     6 --event-viewer        (Opens the application view of the Windows Event Viewer)
       
     7 --unregister      (deletes the root filesystem)
       
     8 --terminate     (Terminates the specified distribution)
       
     9 --set-default   (Sets the distribution as the default)
       
    10 --shutdown      (Immediately terminates all running distributions)
       
    11 --release-notes (Opens a web browser to view the WSL release notes page)
       
    12 --manage        (Changes distro specific options)
       
    13 --install       (Install a Windows Subsystem for Linux distribution)
       
    14 --set-default-version (Changes the default install version for new distributions)
       
    15 --status        (Show the status of Windows Subsystem for Linux)
       
    16 --update        (Update the Windows Subsystem for Linux package)
       
    17 --version       (Display version information)
       
    18 --list          (Lists distributions)
       
    19 --export        (Exports the distribution to a tar file)
       
    20 --import        (Imports the specified tar file as a new distribution)
       
    21 --import-in-place (Imports the specified .vhdx file as a new distribution)'
       
    22 
       
    23   local cur prev
       
    24   cur=${COMP_WORDS[COMP_CWORD]}
       
    25   [[ $COMP_CWORD -gt 1 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
       
    26 
       
    27   if [[ $COMP_CWORD = 1 ]]; then
       
    28     local OIFS="$IFS"
       
    29     local IFS=$'\n'
       
    30     COMPREPLY=( $(compgen -W '$tasks' -- "$cur") )
       
    31     if [[ ${#COMPREPLY[@]} -le 1 ]]; then
       
    32       COMPREPLY=( ${COMPREPLY[0]%% *} )
       
    33     fi
       
    34     IFS=$OIFS
       
    35     return
       
    36   fi
       
    37   return 0
       
    38 } &&
       
    39 complete -F _wsl wsl