diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2016-01-09 18:55:42 +0100 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-01-09 18:58:03 +0100 |
commit | bd482898d4e39905234720178fa47c547b498b39 (patch) | |
tree | c04930fb577a10f67a41787f05efb769ba4ff9cf /share/completions | |
parent | 4417a6ee34e74362a8b95b1ac306bf965b565226 (diff) |
Simplify and stringify valgrind completions
These used _eval_ when a simple variable capturing would have sufficed.
Diffstat (limited to 'share/completions')
-rw-r--r-- | share/completions/valgrind.fish | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/share/completions/valgrind.fish b/share/completions/valgrind.fish index 2d87bbc4..9dfe968c 100644 --- a/share/completions/valgrind.fish +++ b/share/completions/valgrind.fish @@ -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" |