add gcc completion for link lib (#10007)

* add completion for lib

* use path basename && use -a

(cherry picked from commit 3bf80b23742717bd7f16804ae377bc72931eaaaa)
This commit is contained in:
Asuka Minato 2023-09-09 15:29:39 +09:00 committed by Fabian Boehm
parent 67a0c04605
commit 8235fd49ce

View File

@ -490,7 +490,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'