__fish_complete_users: Also test for command, not path

This commit is contained in:
Fabian Homborg 2017-04-25 17:36:22 +02:00
parent 49d3a58a9e
commit 77201ade34

View file

@ -1,9 +1,9 @@
# 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.
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 command -sq getent
command getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
else if test -x /usr/bin/dscl
else if command -sq dscl
# This is the "Directory Service command line utility" used on macOS in place of getent.
command dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
else if test -r /etc/passwd