fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMerge branch 'completions-to-use-expanded-tokens'a9618477e

master
1.4 KiB34 linesraw
1function __cmdkey_complete_args -d 'Function to generate args'
2    set -l current_token (commandline -tc)
3    set -l previous_token (commandline -xc)[-1]
4
5    switch $current_token
6        case '/user:*'
7            __fish_print_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }"
8        case '*'
9            if test "$previous_token" = /delete
10                echo -e '/ras\tDelete remote access entry'
11                return
12            end
13    end
14end
15
16complete -c cmdkey -f -a '(__cmdkey_complete_args)'
17
18complete -c cmdkey -f -n "not __fish_seen_argument -w add: -w generic:" -a /add: \
19    -d 'Add a user name and password'
20complete -c cmdkey -f -n "not __fish_seen_argument -w add: -w generic:" -a /generic: \
21    -d 'Add generic credentials'
22
23complete -c cmdkey -f -n "not __fish_seen_argument -w smartcard -w user:" -a /smartcard \
24    -d 'Retrieve the credential'
25complete -c cmdkey -f -n "not __fish_seen_argument -w smartcard -w user:" -a /user: \
26    -d 'Specify the user or account name'
27
28complete -c cmdkey -f -n "__fish_seen_argument -w user:" -a /pass: -d 'Specify the password'
29
30complete -c cmdkey -f -a /delete: -d 'Specify the user or account name'
31complete -c cmdkey -f -a /delete -d 'Specify the user or account name'
32
33complete -c cmdkey -f -a /list: -d 'Display the list of stored user names and credentials'
34complete -c cmdkey -f -a '/?' -d 'Show help'