fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a53db7256
master
1# localization: skip(private) 2# 3# This should be used where you want user names with a description. Such as in an argument 4# completion. If you just want a list of user names use __fish_print_users. 5# The string replace command takes into account GECOS-formatted description fields, by retaining 6# only the first field, the relevant one, from the comma-separated list 7function __fish_complete_users --description"Print a list of local users, with the real user name as a description" 8if command -sq getent 9command getent passwd| while read -l line 10string split -f 1,5 : --$line | string join\t | string replace -r',.*' '' 11end 12else if command -sq dscl 13# This is the "Directory Service command line utility" used on macOS in place of getent. 14command dscl . -list /Users RealName| string match -r -v'^_' | string replace -r' {2,}' \t 15else if test -r /etc/passwd 16string match -v -r'^\s*#' < /etc/passwd| while read -l line 17string split -f 1,5 : --$line | string join\t | string replace -r',.*' '' 18end 19end 20end