. wf-funcs-sh

description="Find words that match a pattern"
verbose=0
version="1.0"
progname=${0##*/}
wf_cfg=${wf_cfg:-$HOME/.config/wordfinder.cfg}
compounds=

while getopts vVc var
do
  case $var in
   c) compounds=1 ;;
   v) verbose=$(( $verbose + 1 )) ;;
   V) version; exit ;;
   *) printf "%s: invalid option: %s\n" "$progname" "$var"
      exit
      ;;
  esac
done
shift $(( $OPTIND - 1 ))

do_config || exit 5

compounds=${compounds:+$dict/Compounds}
mask=$1
{
    cat $dict/singlewords
    if [ -n "$compounds" ]
    then
        cut -f1 $dict/Compounds
    fi
} | grep -i "^$mask$" | sort -fu

