fish-shell/share/completions/cmdkey.fish

35 lines
1.1 KiB
Fish
Raw Normal View History

function __cmdkey_complete_args --description 'Function to generate args'
set --local current_token (commandline --current-token --cut-at-cursor)
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
2021-11-25 21:16:03 +08:00
switch $current_token
case '/user:*'
2021-11-26 15:48:31 +08:00
__fish_list_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
2021-11-25 21:16:03 +08:00
if not __fish_seen_argument --windows 'add:' --windows 'generic:'
2021-12-16 06:03:02 +08:00
echo -e '/add:\tAdd a user name and password
/generic:\tAdd generic credentials'
end
2021-12-16 06:03:02 +08:00
if not __fish_seen_argument --windows 'smartcard' --windows 'user:'
2021-12-16 06:03:02 +08:00
echo -e '/smartcard\tRetrieve the credential
/user:\tSpecify the user or account name'
end
2021-12-16 06:03:02 +08:00
if __fish_seen_argument --windows 'user:'
2021-12-16 06:03:02 +08:00
echo -e '/pass:\tSpecify the password'
end
2021-12-16 06:03:02 +08:00
echo -e '/delete\tDelete a user name and password
2021-11-25 21:16:03 +08:00
/list:\tDisplay the list of stored user names and credentials
/?\tShow help'
end
2021-11-25 21:16:03 +08:00
end
complete --command cmdkey --no-files --arguments '(__cmdkey_complete_args)'