File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1155,7 +1155,20 @@ __docker_complete_plugin() {
11551155 resultArray+=( " $value " )
11561156 fi
11571157 done
1158- local result=$( eval " ${resultArray[*]} " 2> /dev/null | grep -v ' ^:[0-9]*$' )
1158+ local rawResult=$( eval " ${resultArray[*]} " 2> /dev/null)
1159+ local result=$( grep -v ' ^:[0-9]*$' <<< " $rawResult" )
1160+
1161+ # Compose V2 completions sometimes returns returns `:8` (ShellCompDirectiveFilterFileExt)
1162+ # with the expected file extensions (such as `yml`, `yaml`) to indicate that the shell should
1163+ # provide autocompletions for files with matching extensions
1164+ local completionFlag=$( tail -1 <<< " $rawResult" )
1165+ if [ " $completionFlag " == " :8" ]; then
1166+ # format a valid glob pattern for the provided file extensions
1167+ local filePattern=$( tr ' \n' ' |' <<< " $result" )
1168+
1169+ _filedir " $filePattern "
1170+ return
1171+ fi
11591172
11601173 # if result empty, just use filename completion as fallback
11611174 if [ -z " $result " ]; then
You can’t perform that action at this time.
0 commit comments