You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
Bash
50 lines
1.2 KiB
Bash
4 years ago
|
#!/usr/bin/env bash
|
||
|
# vim:ts=4:sts=4:sw=4:et
|
||
|
#
|
||
|
# Author: Hari Sekhon
|
||
|
# Date: 2020-06-02 19:54:09 +0100 (Tue, 02 Jun 2020)
|
||
|
#
|
||
2 years ago
|
# https://github.com/HariSekhon/DevOps-Bash-tools
|
||
4 years ago
|
#
|
||
|
# License: see accompanying Hari Sekhon LICENSE file
|
||
|
#
|
||
|
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help improve or steer this or other code I publish
|
||
|
#
|
||
2 years ago
|
# https://www.linkedin.com/in/HariSekhon
|
||
4 years ago
|
#
|
||
|
|
||
|
set -euo pipefail
|
||
|
[ -n "${DEBUG:-}" ] && set -x
|
||
3 years ago
|
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
4 years ago
|
|
||
1 year ago
|
# shellcheck disable=SC1090,SC1091
|
||
4 years ago
|
. "$srcdir/lib/utils.sh"
|
||
|
|
||
4 years ago
|
# access to useful functions and aliases
|
||
1 year ago
|
# shellcheck disable=SC1090,SC1091
|
||
4 years ago
|
. "$srcdir/.bash.d/aliases.sh"
|
||
4 years ago
|
|
||
1 year ago
|
# shellcheck disable=SC1090,SC1091
|
||
4 years ago
|
. "$srcdir/.bash.d/functions.sh"
|
||
4 years ago
|
|
||
1 year ago
|
# shellcheck disable=SC1090,SC1091
|
||
4 years ago
|
. "$srcdir/.bash.d/git.sh"
|
||
|
|
||
4 years ago
|
# shellcheck disable=SC2034
|
||
2 years ago
|
usage_description="
|
||
|
Runs any arguments as a command against each file with a Git modified status
|
||
4 years ago
|
|
||
2 years ago
|
The filename will be appended to the end of each command in each iteration
|
||
|
"
|
||
4 years ago
|
|
||
|
# shellcheck disable=SC2034
|
||
4 years ago
|
usage_args="<command> <args>"
|
||
4 years ago
|
|
||
|
help_usage "$@"
|
||
|
|
||
2 years ago
|
min_args 1 "$@"
|
||
|
|
||
4 years ago
|
for filename in $(git status --porcelain | awk '/^.M/{print $NF}'); do
|
||
|
"$@" "$filename"
|
||
|
done
|