#!/bin/bash

usage(){
    echo "Usage: $(basename $0) <pathResource> <pathResult>"
    echo
    echo "       <pathResource>  File or directory to convert with extracted Confluence export"
    echo "       <pathResult>    Directory to where the output will be generated to."
    echo
    exit
}

if [ -z "$1" ] || [ x"$1" == x"--help" ] || [ x"$1" == x"-h" ]; then
    usage
fi

if [ ! -d "$1" ]; then
    echo "$1 is no directory" >&2
    usage
fi
if [ ! -d "$2" ]; then
    echo "$2 is no directory" >&2
    usage
fi

cd "/usr/share/confluence-to-markdown"
npm run start "$1" "$2"
cd -
