#!/bin/bash
set -e
adr_bin_dir=/usr/libexec/adr-tools
adr_template_dir=/usr/share/adr-tools

## usage: adr init [DIRECTORY]
##
## Initialises the directory of architecture decision records:
##
##  * creates a subdirectory of the current working directory
##  * creates the first ADR in that subdirectory, recording the decision to
##    record architectural decisions with ADRs.
##
## If the DIRECTORY is not given, the ADRs are stored in the directory `doc/adr`.

if [ -n "$1" ]
then
    mkdir -p "$1"
    echo "$1" > .adr-dir
fi

VISUAL=true ADR_TEMPLATE="$adr_template_dir/init.md" \
      "$adr_bin_dir/adr-new" record-architecture-decisions
