From 3bf80b23742717bd7f16804ae377bc72931eaaaa Mon Sep 17 00:00:00 2001
From: Asuka Minato <i@asukaminato.eu.org>
Date: Sat, 9 Sep 2023 15:29:39 +0900
Subject: [PATCH] add gcc completion for link lib (#10007)

* add completion for lib

* use path basename && use -a
---
 share/completions/gcc.fish | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/share/completions/gcc.fish b/share/completions/gcc.fish
index 9373cb393..6a7ca6d57 100644
--- a/share/completions/gcc.fish
+++ b/share/completions/gcc.fish
@@ -482,7 +482,9 @@ complete -c gcc -s c -d 'Compile or assemble the source files, but do not link.'
 complete -c gcc -s S -d 'Stop after the stage of compilation proper; do not assemble'
 complete -c gcc -s E -d 'Stop after the preprocessing stage; do not run the compiler proper'
 complete -c gcc -o llibrary -d 'Search the library named library when linking'
+complete -c gcc -a '-l(path basename /usr/lib/lib*.so* | string match -r -g "^lib(.*?)\.so.*")'
 complete -c gcc -s l -d 'Search the library named library when linking'
+complete -c gcc -o ldl -d 'Search the dynamic loader library when linking'
 complete -c gcc -o lm -d 'Search the math library when linking'
 complete -c gcc -o lz -d 'Search the zlib library when linking'
 complete -c gcc -o lrt -d 'Search the realtime extensions library when linking'