Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix portmaster completions when there are no matches #3950

wants to merge 1 commit into from


Copy link

@asomers asomers commented Apr 11, 2017

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

Fixes #3949


  • [N/A] Changes to fish usage are reflected in user documentation/manpages.
  • [N/A] Tests have been added for regressions fixed
  • [N/A] User-visible changes noted in
Don't spew warnings when there are no matches.  Also, use the string
builtin instead of calling sed.

Fixes #3949
@@ -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
complete -c portmaster -f --description 'Ports Directory' -a "
ls -d /usr/ports/(commandline -ct)*/ \
| sed -E -e 's#/usr/ports/##' -e 's#/+#/#' -e 's#([^/]+/[^/]+).*#\1#'
string match -r '(?<=/usr/ports/)[^/]*(?:/[^/]*)?' (__fish_complete_directories /usr/ports/(commandline -ct))

This comment has been minimized.


krader1961 Apr 11, 2017

Nice use of PCRE features. Note that the (__fish_complete_directories /usr/ports/(commandline -ct)) does expand past two levels. Your PCRE ensures that only the first two levels are emitted by the completion. It's probably not worthwhile optimizing this any further. I just wanted to make sure you were aware that levels three and higher are expanded by __fish_complete_directories before being trimmed to two levels by the string match.

@krader1961 krader1961 added the bug label Apr 11, 2017
@krader1961 krader1961 added this to the 2.6.0 milestone Apr 11, 2017
Copy link

@krader1961 krader1961 commented Apr 11, 2017

I went ahead and merged this as commit ed6298a because it is likely @asomers knew about the behavior of __fish_complete_directories and deemed any additional optimization not worth the effort.

@krader1961 krader1961 closed this Apr 11, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.