dotfiles/bin/.local/bin/golangci-lintw

23 lines
532 B
Fish
Executable file

#!/usr/bin/env fish
#set fish_trace 1
set file $argv[-1]
#golangci-lint $argv[1..-2] | sed -n "/$file/,+2p"
set capture false
golangci-lint $argv[1..-2] | while read --local --line line
if string match --quiet --regex '^.+:[0-9]+:' $line
set -l lineFilename (string match --regex '[^:]+' $line)
if test $file = $lineFilename -o $file = (pwd)/$lineFilename
set capture true
else
set capture false
end
end
if test $capture = true
echo $line
end
end