diff --git a/fish/functions/git_py_files.fish b/fish/functions/git_py_files.fish new file mode 100644 index 00000000..0d0f4cec --- /dev/null +++ b/fish/functions/git_py_files.fish @@ -0,0 +1,14 @@ +#!/usr/bin/env fish +# SPDX-License-Identifier: MIT +# Copyright (C) 2024 Nathan Chancellor + +function git_py_files -d "Get Python files checked into current repository for linting" + # Get list of files, specifically excluding this one, as it is a false + # positive due to the command used :) We pass through realpath and uniq + # to handle files that may be symlinked multiple times like korg_tc, + # which can make linting annoying otherwise + set files (git ls-files | grep -Fv (status function).fish | xargs realpath | uniq | string replace "$PWD/" '') + + # Sort after ripgrep because sorting within ripgrep reduces parallelism + rg -l '#!/usr/bin/env python' $files | sort +end