2017-04-24 03:08:40 +00:00
|
|
|
# This should be used where you want user names with a description. Such as in an argument
|
|
|
|
# completion. If you just want a list of user names use __fish_print_users.
|
2007-09-21 20:52:12 +00:00
|
|
|
function __fish_complete_users --description "Print a list of local users, with the real user name as a description"
|
2016-11-28 05:27:22 +00:00
|
|
|
if test -x /usr/bin/getent
|
2017-04-25 08:20:48 +00:00
|
|
|
command getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
|
2016-11-28 05:27:22 +00:00
|
|
|
else if test -x /usr/bin/dscl
|
2017-04-24 03:08:40 +00:00
|
|
|
# This is the "Directory Service command line utility" used on macOS in place of getent.
|
2017-04-25 08:20:48 +00:00
|
|
|
command dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
2017-04-24 03:08:40 +00:00
|
|
|
else if test -r /etc/passwd
|
2016-11-28 05:27:22 +00:00
|
|
|
string match -v -r '^\s*#' </etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
|
|
|
end
|
2007-09-21 20:52:12 +00:00
|
|
|
end
|