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

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@asomers
Contributor

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

TODOs:

  • [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 CHANGELOG.md
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
@@ -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

krader1961 Apr 11, 2017

Contributor

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 Apr 11, 2017

Contributor

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

@krader1961

This comment has been minimized.

Show comment
Hide comment
@krader1961

krader1961 Apr 11, 2017

Contributor

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.

Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment