fish-shell/share/functions/__fish_reg__complete_keys.fish
Unbelievable Mystery 262e2d5fe6
Update completions for: wine (#10789)
* feat(function): move cmd completion function to a separate file

* feat(completion): support wine cmd subcommand

* feat(completion): support wine control subcommand

* feat(completion): support wine eject subcommand

* feat(completion): support wine explorer subcommand

* feat(completion): support wine explorer subcommand for desktops

* feat(completion): support wine start subcommand

* feat(completion): support wine winemenubuilder subcommand

* feat(completion): support wine winepath subcommand

* fix(function): rename function for cmd argument completion

* feat(function): implement function to complete registry keys

* feat(completion): support wine regedit subcommand

* feat(function): add top-level key descriptions

* fix(completion): remove redundant comment

* feat(completion): support wine msiexec subcommand

* refactor(completion): group code into functions

* feat(completion): enhance subcommand descriptions
2024-11-17 14:58:21 -08:00

30 lines
1.1 KiB
Fish

function __fish_reg__complete_keys
set -l current_token (commandline -tc | string unescape)
set -l default_keys 'HKEY_CLASSES_ROOT\tThe information about file extension associations' \
'HKEY_CURRENT_USER\tThe information about a current user' \
'HKEY_LOCAL_MACHINE\tThe information about a current machine' \
'HKEY_USERS\tThe information about loaded users' \
'HKEY_CURRENT_CONFIG\tThe information about hardware used while startup' \
HKEY_DYN_DATA
if string match --quiet --entire --regex '\\\\' -- "$current_token"
set current_token (string replace --regex '\\\\[^\\\\]*$' '' -- "$current_token")
set -l keys (WINEDEBUG=-all wine reg query "$current_token" |
string replace --regex '\r' '' |
string match --entire --regex '\w')
test $pipestatus[1] != 0 && return
string join \n -- $keys |
string match --invert "$current_token" |
string replace --all --regex '[\\\\]+' '\\\\'
else
for key in $default_keys
echo -e $key
end
end
end
complete -c true -a '(__fish_reg__complete_keys)'