# HG changeset patch # User Oleksandr Gavenko # Date 1702239806 -7200 # Node ID 1c38c02cfe9e87597daa23a560e2e9e608356d01 # Parent 7353d0eeff27439775dfb2d81d913a39a959d18b Basic wsl Bash completion. diff -r 7353d0eeff27 -r 1c38c02cfe9e .local/share/bash-completion/completions/wsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.local/share/bash-completion/completions/wsl Sun Dec 10 22:23:26 2023 +0200 @@ -0,0 +1,39 @@ +# -*- mode: sh; sh-shell-file: bash -*- + +_wsl() { + local tasks='--help (Display usage information) +--debug-shell (Open a WSL2 debug shell for diagnostics purposes) +--event-viewer (Opens the application view of the Windows Event Viewer) +--unregister (deletes the root filesystem) +--terminate (Terminates the specified distribution) +--set-default (Sets the distribution as the default) +--shutdown (Immediately terminates all running distributions) +--release-notes (Opens a web browser to view the WSL release notes page) +--manage (Changes distro specific options) +--install (Install a Windows Subsystem for Linux distribution) +--set-default-version (Changes the default install version for new distributions) +--status (Show the status of Windows Subsystem for Linux) +--update (Update the Windows Subsystem for Linux package) +--version (Display version information) +--list (Lists distributions) +--export (Exports the distribution to a tar file) +--import (Imports the specified tar file as a new distribution) +--import-in-place (Imports the specified .vhdx file as a new distribution)' + + local cur prev + cur=${COMP_WORDS[COMP_CWORD]} + [[ $COMP_CWORD -gt 1 ]] && prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD = 1 ]]; then + local OIFS="$IFS" + local IFS=$'\n' + COMPREPLY=( $(compgen -W '$tasks' -- "$cur") ) + if [[ ${#COMPREPLY[@]} -le 1 ]]; then + COMPREPLY=( ${COMPREPLY[0]%% *} ) + fi + IFS=$OIFS + return + fi + return 0 +} && +complete -F _wsl wsl