fork/fish-shell

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

Johannes Altmanninger__fish_complete_list: strip "--foo=" prefix from replacing completions320ebb685

master
2.8 KiB45 linesraw
1function __fish_cryptenroll_pkcs11_devices
2    systemd-cryptenroll --pkcs11-token-uri=list 2>/dev/null | tail -n +2 | string replace -r '(\S+)\s(\S+).*' '$1\t$2'
3    echo -e "auto\tautomatically determine URI of security token"
4    echo -e "list\tlist available PKCS#11 tokens"
5end
6
7function __fish_cryptenroll_fido2_devices
8    systemd-cryptenroll --fido2-device=list 2>/dev/null | tail -n +2 | string replace -ar ' +' ' ' | string replace -r '(\S+)\s(.*)' '$1\t$2'
9    echo -e "auto\tautomatically determine device node of security token"
10    echo -e "list\tlist available FIDO2 tokens"
11end
12
13function __fish_cryptenroll_tpm2_devices
14    systemd-cryptenroll --tpm2-device=list 2>/dev/null | tail -n +2 | string replace -r '(\S+)\s(\S+).*' '$1\t$2'
15    echo -e "auto\tautomatically determine device node of TPM2 device"
16    echo -e "list\tlist available TPM2 devices"
17end
18
19function __fish_cryptenroll_complete_wipe
20    echo -e "all\twipe all key slots"
21    echo -e "empty\twipe key slots unlocked by an empty passphrase"
22    echo -e "password\twipe key slots unlocked by a traditional passphrase"
23    echo -e "recovery\twipe key slots unlocked by a recovery key"
24    echo -e "pkcs11\twipe key slots unlocked by a PKCS#11 token"
25    echo -e "fido2\twipe key slots unlocked by a FIDO2 token"
26    echo -e "tpm2\twipe key slots unlocked by a TPM2 chip"
27    for i in (seq 0 31)
28        echo -e "$i\twipe key slot $i"
29    end
30end
31
32complete -c systemd-cryptenroll -xa "(__fish_complete_blockdevice)"
33
34complete -c systemd-cryptenroll -l password -d "Enroll a regular password"
35complete -c systemd-cryptenroll -l recovery-key -d "Enroll an auto-generated recovery key"
36complete -c systemd-cryptenroll -l pkcs11-token-uri -kxa "(__fish_cryptenroll_pkcs11_devices)" -d "Enroll a PKCS#11 security token or smartcard"
37complete -c systemd-cryptenroll -l fido2-device -kxa "(__fish_cryptenroll_fido2_devices)" -d "Enroll a FIDO2 security token"
38complete -c systemd-cryptenroll -l fido2-with-client-pin -xa "yes no" -d "Require to enter a PIN when unlocking the volume"
39complete -c systemd-cryptenroll -l fido2-with-user-presence -xa "yes no" -d "Require to verify presence when unlocking the volume"
40complete -c systemd-cryptenroll -l fido2-with-user-verification -xa "yes no" -d "Require user verification when unlocking the volume"
41complete -c systemd-cryptenroll -l tpm2-device -kxa "(__fish_cryptenroll_tpm2_devices)" -d "Enroll a TPM2 security chip"
42complete -c systemd-cryptenroll -l tpm2-pcrs -x -d "Bind the enrollment of TPM2 device to specified PCRs"
43complete -c systemd-cryptenroll -l wipe-slot -kxa "(__fish_stripprefix='^--wipe-slot=' __fish_complete_list , __fish_cryptenroll_complete_wipe)" -d "Wipes one or more LUKS2 key slots"
44complete -c systemd-cryptenroll -l help -s h -d "Print a short help"
45complete -c systemd-cryptenroll -l version -d "Print a short version string"