Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 52 lines (38 sloc) 758 Bytes
#!/usr/bin/env bash
###
### git-status: Add convenience options to git-status(1).
###
ERR_NOTREPO="Not a Git repository."
# Arguments, options.
ARGV=()
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
exec $GIT status --help
;;
-N|--numbered)
if [[ ! "$($GIT rev-parse --is-inside-work-tree)" ]] 2>/dev/null; then
printf '%s: %s\n' "$0" "$ERR_NOTREPO"
exit 1
fi
COUNT=0
# Prepend index # to pathspec.
$GIT status -s | while read LINE; do
{
let COUNT++
echo "${COUNT}. $LINE"
}
done
exit $?
;;
*)
ARGV+=("$1")
shift
;;
esac
done
if [[ ! "$($GIT rev-parse --is-inside-work-tree)" ]] 2>/dev/null; then
printf '%s: %s\n' "$0" "$ERR_NOTREPO"
exit 1
fi
exec $GIT status "${ARGV[@]}"