Complete IDs for unix users and groups that start with _

This commit is contained in:
Johannes Altmanninger 2020-03-08 17:43:52 +01:00
parent 8320467bb0
commit 685b668958
2 changed files with 4 additions and 4 deletions

View File

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

View File

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