#!/bin/bash -i

# Check if the first argument is "activate", and set the PATH environment variable accordingly
if [ "$1" = "activate" ]; then

    # Environment variables
    export PLANUTILS_PREFIX="~/.planutils"
    export PATH="$PATH:$PLANUTILS_PREFIX/bin"

    # Add a blue coloured shell prompt prefix (planutils)
    export PS1="(\[\e[1;34m\]planutils\[\e[0m\]) $PS1"

    echo
    echo "   Entering planutils environment..."
    echo

    # Enter the shell
    $SHELL --init-file <(echo "export PS1=\"$PS1\"")

# Else, call planutils via python
else
    python3 -c "import planutils; planutils.main()" "$@"
fi

# Clear history
history -cw
