#!/bin/sh

usage()
{
	cat <<EOF
usage: oikonomi [OPTIONS]

Options:
  --from FROM  Fetch transactions starting FROM, given as YYYY-MM-DD
  --learn      Prompt for account information on guessing failures
  --help       Show this help
EOF
}

name=$(mktemp)
learn=
from=

while true
do
	case "$1" in
		--help)
			usage
			exit 0
			;;
		--learn)
			learn=--learn
			;;
		--from)
			from=$2
			shift
			;;
		?*)
			usage
			exit 1
			;;
		*)
			break
	esac

	shift
done

oiko --from $from > "$name"
nomi $learn "$name"

rm "$name"
