$shebang

#This script was auto generated by "rnmd" a runtime to execute code contained inside markdown documents

# ---------- Installer
$installer_code

# ---------- Proxy to Runtime and target document

TARGET_DOC="$markdown_doc_path"
BACKUP_DOC="$backup_path"
DOC_EXISTS=$$(rnmd $$TARGET_DOC --check)

if [ ! $$DOC_EXISTS = "True" ]; then
    echo "The markdown file "$$TARGET_DOC" linked to by this proxy does not exist."
    echo "Did you move the file -> if so please reinstall for the new path by: "
    echo "'rnmd NEW_MARKDOWN_PATH --install SCRIPTNAME'"

    read -p "Do you want to try to run the backup instead? (y/n)" answer
    if [ $$answer = "y" ]; then
       $runner$runtime_path "$$BACKUP_DOC" --args "$$@"
    fi

    exit -1
fi

if [ "$update_backup" = "True" ]; then
    $runner$runtime_path "$$TARGET_DOC" --backupto "$$BACKUP_DOC" --force --silent
fi

$runner$runtime_path "$$TARGET_DOC" --args "$$@"