#!/usr/bin/env bash

. hooks/_tox_base

# set -x

if [ -z "${COLLECTION_DIR}" ]
then
  echo "missing collection directory"
  echo "run 'make install' first"

  exit 1
fi

if [ -d ${COLLECTION_DIR} ]
then
  ansible_modules=$(
    ansible-doc --list -t module bodsch.core --json | jq -r 'keys[]'
  )


  for i in ${ansible_modules}
  do
    # echo " - ${i}"
    PAGER='cat' ansible-doc --type module ${i}
    echo ""
  done
fi

exit 0
