Fix portmaster completions when there are no matches

Don't spew warnings when there are no matches.  Also, use the string
builtin instead of calling sed.

Fixes #3949
This commit is contained in:
Alan Somers 2017-04-10 20:14:21 -06:00 committed by Kurtis Rader
parent 252c821cb3
commit ed6298ad17

View file

@ -48,8 +48,7 @@ complete -c portmaster -l version --description 'display the version number El E
# Grab items from the ports directory, max depth 2 # Grab items from the ports directory, max depth 2
complete -c portmaster -f --description 'Ports Directory' -a " complete -c portmaster -f --description 'Ports Directory' -a "
( (
ls -d /usr/ports/(commandline -ct)*/ \ string match -r '(?<=/usr/ports/)[^/]*(?:/[^/]*)?' (__fish_complete_directories /usr/ports/(commandline -ct))
| sed -E -e 's#/usr/ports/##' -e 's#/+#/#' -e 's#([^/]+/[^/]+).*#\1#'
)" )"
complete -c portmaster -f --description 'Installed Package' -a "(__fish_print_packages)" complete -c portmaster -f --description 'Installed Package' -a "(__fish_print_packages)"