mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-13 09:40:42 +01:00
batdiff: Make --all default behavior for no arguments
This commit is contained in:
parent
4761b594a6
commit
0f6529a0d8
@ -141,24 +141,23 @@ fi
|
|||||||
# Validation:
|
# Validation:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
# Handle no files.
|
|
||||||
if [[ "${#FILES[@]}" -eq 0 ]] && ! "$OPT_ALL_CHANGES"; then
|
|
||||||
print_error "no files provided"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle too many files.
|
# Handle too many files.
|
||||||
if [[ "${#FILES[@]}" -gt 2 ]]; then
|
if [[ "${#FILES[@]}" -gt 2 ]]; then
|
||||||
print_error "too many files provided"
|
print_error "too many files provided"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Handle deprecated --all.
|
||||||
|
if "$OPT_ALL_CHANGES"; then
|
||||||
|
print_warning "argument --all is deprecated. Use '%s' instead" "$0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Main:
|
# Main:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
main() {
|
main() {
|
||||||
if "$OPT_ALL_CHANGES"; then
|
if [[ "${#FILES[@]}" -eq 0 ]] || "$OPT_ALL_CHANGES"; then
|
||||||
local file
|
local file
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
if [[ -f "$file" ]]; then
|
if [[ -f "$file" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user