From fa00183e5f864e54c7fefe9946f1db4124cae3e1 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Tue, 19 Jun 2018 00:10:40 -0500 Subject: [PATCH] Fix and optimize kldload completions I'm not sure what was wrong with the old syntax, but I needed to switch the outer quotes to ' and the inner quotes to " in order for the completions to work when they weren't explicitly sourced. Additionally, realized that the overload for __fish_complete_suffix can be used to get the filtered list of kernel modules from /boot/kernel in the initial run. --- share/completions/kldload.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/completions/kldload.fish b/share/completions/kldload.fish index f55c9e211..4e430911a 100644 --- a/share/completions/kldload.fish +++ b/share/completions/kldload.fish @@ -2,8 +2,8 @@ # Only attempt to match a local file if there isn't a match in /boot/kernel, # as odds are that is the desired source. -complete -c kldload -xa "( - set results (find /boot/kernel -depth 1 -iname (commandline -ct)'*.ko' | sed 's@.*/@@g;s/\.ko//'); - set -q results[1]; and printf '%s\n' $results; +complete -c kldload -xa '( + set results (__fish_complete_suffix /boot/kernel/(commandline -ct) ".ko" | sed "s@.*/@@g;s/\.ko//"); + set -q results[1]; and printf "%s\n" $results; or __fish_complete_suffix .ko -)" +)'