dogfood string split -f

This commit is contained in:
Jason Nader
2020-04-18 14:58:07 +09:00
committed by Johannes Altmanninger
parent 3bb86d3a61
commit f66285d7a1
5 changed files with 15 additions and 13 deletions

View File

@@ -2,8 +2,7 @@
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command
# gpg doesn't seem to like it when you use the whole key name as a
# completion, so we skip the <EMAIL> part and use it as a
# description.
# It also replaces colons with \x3a
$__fish_complete_gpg_command --list-keys --with-colon | cut -d : -f 10 | sed -ne 's/\\\x3a/:/g' -e 's/\(.*\) <\(.*\)>/\1'\t'\2/p'
# completion, so we skip the <EMAIL> part and use it as a description.
# It also replaces \x3a from gpg's output with colons.
$__fish_complete_gpg_command --list-keys --with-colon | string split -a -f 10 : | string replace '\x3a' : | string replace -rf '(.*) <(.*)>' '$1\t$2'
end