Skip to content

Instantly share code, notes, and snippets.

@filips123
Created July 9, 2024 20:22
Show Gist options
  • Save filips123/e49955ad672830bb992a03a056414808 to your computer and use it in GitHub Desktop.
Save filips123/e49955ad672830bb992a03a056414808 to your computer and use it in GitHub Desktop.
Winget tab completion in Zsh
#compdef winget
function _winget {
local word="${words[CURRENT]}"
local commandline="${words[*]}"
local position="$(( $CURSOR ))"
local completions
completions=("${(f)$(winget complete --word "${word}" --commandline "${words}" --position $position 2>/dev/null)}")
completions=("${completions[@]//$'\r'/}")
_describe "command" completions -o nosort
}
compdef _winget winget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment