fish-shell/share/completions/cmdkey.fish

35 lines
1.4 KiB
Fish
Raw Normal View History

function __cmdkey_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc)
set -l previous_token (commandline -xc)[-1]
2021-11-25 13:16:03 +00:00
switch $current_token
case '/user:*'
__fish_print_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }"
case '*'
if test "$previous_token" = /delete
echo -e '/ras\tDelete remote access entry'
return
end
end
end
2021-11-25 13:16:03 +00:00
complete -c cmdkey -f -a '(__cmdkey_complete_args)'
2021-12-15 22:03:02 +00:00
complete -c cmdkey -f -n "not __fish_seen_argument -w add: -w generic:" -a /add: \
-d 'Add a user name and password'
complete -c cmdkey -f -n "not __fish_seen_argument -w add: -w generic:" -a /generic: \
-d 'Add generic credentials'
2021-12-15 22:03:02 +00:00
complete -c cmdkey -f -n "not __fish_seen_argument -w smartcard -w user:" -a /smartcard \
-d 'Retrieve the credential'
complete -c cmdkey -f -n "not __fish_seen_argument -w smartcard -w user:" -a /user: \
-d 'Specify the user or account name'
2021-12-15 22:03:02 +00:00
complete -c cmdkey -f -n "__fish_seen_argument -w user:" -a /pass: -d 'Specify the password'
complete -c cmdkey -f -a /delete: -d 'Specify the user or account name'
complete -c cmdkey -f -a /delete -d 'Specify the user or account name'
2021-11-25 13:16:03 +00:00
complete -c cmdkey -f -a /list: -d 'Display the list of stored user names and credentials'
complete -c cmdkey -f -a '/?' -d 'Show help'