2022-01-24 13:51:09 +08:00
|
|
|
function __cmdkey_complete_args --description 'Function to generate args'
|
2021-11-26 15:36:26 +08:00
|
|
|
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
|
|
|
|
2021-11-26 15:36:26 +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 }"
|
2021-11-26 15:36:26 +08:00
|
|
|
case '*'
|
|
|
|
if test "$previous_token" = '/delete'
|
|
|
|
echo -e '/ras\tDelete remote access entry'
|
|
|
|
return
|
|
|
|
end
|
2021-11-25 21:16:03 +08:00
|
|
|
|
2021-11-26 15:36:26 +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'
|
2021-11-26 15:36:26 +08:00
|
|
|
end
|
2021-12-16 06:03:02 +08:00
|
|
|
|
2021-11-26 15:36:26 +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'
|
2021-11-26 15:36:26 +08:00
|
|
|
end
|
2021-12-16 06:03:02 +08:00
|
|
|
|
2021-11-26 15:36:26 +08:00
|
|
|
if __fish_seen_argument --windows 'user:'
|
2021-12-16 06:03:02 +08:00
|
|
|
echo -e '/pass:\tSpecify the password'
|
2021-11-26 15:36:26 +08:00
|
|
|
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'
|
2021-11-26 15:36:26 +08:00
|
|
|
end
|
2021-11-25 21:16:03 +08:00
|
|
|
end
|
|
|
|
|
2022-01-24 13:51:09 +08:00
|
|
|
complete --command cmdkey --no-files --arguments '(__cmdkey_complete_args)'
|