# vim: ft=sh:noml:

# initialize a TODO file in the common location
if [ -f "TODO.md" ]; then
  echo "There is already a TODO.md file" >&2
  return 1
fi

todo_dir="${XDG_TODO_DIR:-${HOME}/Todo}"
name=$(basename -- "$(pwd)")

if [ -f "${todo_dir}/${name}.md" ]; then
  echo "There is already a ${name}.md file in the ${todo_dir} directory, linking to it" >&2
else
  printf '# %s\n\n' Periodic Cleaning Bugs Testing Improvements Features Research \
    > "${todo_dir}/${name}.md"
fi

ln -s "${todo_dir}/${name}.md" TODO.md
