fish-shell/share/functions/__fish_complete_user_ids.fish
2020-03-10 20:56:45 +01:00

7 lines
347 B
Fish

function __fish_complete_user_ids --description "Complete user IDs with user name as description"
if command -sq getent
getent passwd | string replace -f -r '^([[:alpha:]_][^:]*):[^:]*:(\d+).*' '$2\t$1'
else if test -r /etc/passwd
string replace -f -r '^([[:alpha:]_][^:]*):[^:]*:(\d+).*' '$2\t$1' </etc/passwd
end
end