diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-01-29 15:42:52 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-01-29 15:42:52 -0800 |
commit | 20130d89dc2c33faefd4e3bec9acbbe2e2cded0b (patch) | |
tree | 22a27e5eb67f6bdbbb53ee39cc2752d690d5398e /share/functions/__fish_print_make_targets.fish | |
parent | 8490aac025566e8f88f71d8bfb1a3789d725eda3 (diff) |
Support for escaped colons in makefile targets in __fish_print_make_targets, as part of #1259
Diffstat (limited to 'share/functions/__fish_print_make_targets.fish')
-rw-r--r-- | share/functions/__fish_print_make_targets.fish | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/share/functions/__fish_print_make_targets.fish b/share/functions/__fish_print_make_targets.fish index 5be984b8..8848f270 100644 --- a/share/functions/__fish_print_make_targets.fish +++ b/share/functions/__fish_print_make_targets.fish @@ -1,8 +1,15 @@ function __fish_print_make_targets - set files Makefile makefile GNUmakefile # Some seds (e.g. on Mac OS X), don't support \n in the RHS # Use a literal newline instead # http://sed.sourceforge.net/sedfaq4.html#s4.1 - sgrep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files ^/dev/null | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\\ + # The 'rev | cut | rev' trick removes everything after the last colon + for file in GNUmakefile Makefile makefile + if test -f $file + sgrep -h -o -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $file ^/dev/null | rev | cut -d ":" -f 2- | rev | sed -e 's/^ *//;s/ *$//;s/ */\\ /g' ^/dev/null + # On case insensitive filesystems, Makefile and makefile are the same; stop now so we don't double-print + break + end + end end + |