mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Simplify and stringify valgrind completions
These used _eval_ when a simple variable capturing would have sufficed.
This commit is contained in:
parent
4417a6ee34
commit
bd482898d4
1 changed files with 7 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
# Don't go invoking valgrind unless it is installed
|
||||
|
||||
set -l skin tool
|
||||
if begin ; type valgrind >/dev/null ; and valgrind --version ^/dev/null | __fish_sgrep -- '-2\.[012]\.' >/dev/null ^/dev/null ; end
|
||||
if type -q valgrind; and valgrind --version ^/dev/null | string match -qr -- '-2\.[012]\.'
|
||||
# In older versions of Valgrind, the skin selection option was
|
||||
# '--skin'
|
||||
# But someone decided that it would be fun to change this to
|
||||
|
@ -17,16 +17,16 @@ complete -xc valgrind -l $skin --description "Skin" -a "
|
|||
massif\tHeap\ profiler
|
||||
"
|
||||
|
||||
eval "
|
||||
function __fish_valgrind_skin --argument tool
|
||||
function __fish_valgrind_skin --argument tool -V skin
|
||||
set -l cmd (commandline -cpo)
|
||||
if contains -- --$skin=\$tool \$cmd
|
||||
# Quote $cmd so the tokens are separated with a space
|
||||
if string match -qr -- "--$skin(=| )$tool" "$cmd"
|
||||
return 0
|
||||
end
|
||||
test \$tool = memcheck
|
||||
and echo \$cmd | grep -qve $skin
|
||||
# memcheck is the default tool/skin
|
||||
test $tool = memcheck
|
||||
and not string match -- $skin $cmd
|
||||
end
|
||||
"
|
||||
|
||||
complete -c valgrind -l help --description "Display help and exit"
|
||||
complete -c valgrind -l help-debug --description "Display help and debug options"
|
||||
|
|
Loading…
Reference in a new issue