mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
__fish_complete_users: Use command
, not a hardcoded path
This commit is contained in:
parent
937c229b2e
commit
49d3a58a9e
1 changed files with 2 additions and 2 deletions
|
@ -2,10 +2,10 @@
|
||||||
# completion. If you just want a list of user names use __fish_print_users.
|
# completion. If you just want a list of user names use __fish_print_users.
|
||||||
function __fish_complete_users --description "Print a list of local users, with the real user name as a description"
|
function __fish_complete_users --description "Print a list of local users, with the real user name as a description"
|
||||||
if test -x /usr/bin/getent
|
if test -x /usr/bin/getent
|
||||||
/usr/bin/getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
|
command getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
|
||||||
else if test -x /usr/bin/dscl
|
else if test -x /usr/bin/dscl
|
||||||
# This is the "Directory Service command line utility" used on macOS in place of getent.
|
# This is the "Directory Service command line utility" used on macOS in place of getent.
|
||||||
/usr/bin/dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
command dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
||||||
else if test -r /etc/passwd
|
else if test -r /etc/passwd
|
||||||
string match -v -r '^\s*#' </etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
string match -v -r '^\s*#' </etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue