#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
. "../bash/profile.sh";

if ! grep "\baliae\b" ~/.bashrc > /dev/null
then
    {
        echo '# aliae';
        echo 'eval "$(aliae init bash)"';
        echo "";
    } >> ~/.bashrc;
fi;

profileFile="$(pwsh -c '$PROFILE')";

if [ ! -f "$profileFile" ] || ! grep "\baliae\b" "$profileFile" > /dev/null
then
    pwsh "./install.ps1";
fi;

{
    echo 'eval "$(aliae completion bash)"';
} | addBashProfile "aliae";

popd > /dev/null;