]> Sergey Matveev's repositories - bfs.git/blob - tests/find-color.sh
Skip mtab
[bfs.git] / tests / find-color.sh
1 #!/usr/bin/env bash
2
3 # Copyright © Tavian Barnes <tavianator@tavianator.com>
4 # SPDX-License-Identifier: 0BSD
5
6 set -e
7
8 L=
9 COLOR=
10 ARGS=()
11 for ARG; do
12     case "$ARG" in
13         -L)
14             L="$ARG"
15             ;;
16         -color)
17             COLOR=y
18             ;;
19         *)
20             ARGS+=("$ARG")
21             ;;
22     esac
23 done
24
25 LS_COLOR="${BASH_SOURCE%/*}/ls-color.sh"
26
27 if [ "$COLOR" ]; then
28     find "${ARGS[@]}" -exec "$LS_COLOR" $L {} \;
29 else
30     find "${ARGS[@]}"
31 fi