usage ()
{
echo "usage: $(basename "$0") [--check] <file|dir>+"
+ echo " $(basename "$0") --print-dictionary"
}
make_absolute ()
files=$(mktemp)
trap 'rm -f "$files"' EXIT
+ if [ $# -eq 1 ] && [ "$1" = "--print-dictionary" ]; then
+ print_dictionary=true
+ return
+ fi
+
while true; do
case " $1 " in
" --check ")
done
}
+print_dictionary ()
+{
+ local i word replacement
+ i=0
+ for word in "${words[@]}"; do
+ replacement=${replacements[$i]}
+ i=$((i + 1))
+
+ if [ "$word" == "" ]; then
+ continue
+ fi
+
+ echo "$word -> $replacement"
+ done
+}
+
find_files_matching_words ()
{
local cache_id
{
declare -a unique_files
check=false
+ print_dictionary=false
parse_args "$@"
get_dictionary
declare -a replacements
parse_dictionary
+ if $print_dictionary; then
+ print_dictionary
+ exit 0
+ fi
+
# Reduce set of files for sed to operate on.
local files_matching_words
declare -a files_matching_words