#!/usr/bin/env bash
which doctoc > /dev/null || {
  echo "requires to have https://www.npmjs.com/package/doctoc installed, either globally or just in this repo"
  echo "(it is not installed as a dev dependency as the use made of it it's not worth the subdependencies maintainance)"
  exit 1
}

doctoc README.md docs/*md
sed -i 's/#how-to/docs\/how_to\.md/' README.md
sed -i 's/#cli/docs\/cli\.md/' README.md
sed -i 's/#module/docs\/module\.md/' README.md
