#!/usr/bin/env bash
export PANAMA_PATH="$HOME/.local/share/Panama"
export PANAMA_BASH="$PANAMA_PATH/config/bash"

[ -f /etc/bashrc ] && . /etc/bashrc

if [ -d ~/.bashrc.d ]; then
    for rc in ~/.bashrc.d/*; do
        if [ -f "$rc" ]; then
            . "$rc"
        fi
    done
  unset rc
fi

if [ -d "$PANAMA_BASH" ]; then
  for f in "$PANAMA_BASH"/*; do
    [ -f "$f" ] && . "$f"
  done
  unset f
else
  if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
  fi
  export PATH
fi
# rustup writes this file, and initial-packages installs rustup rather than
# running rustup-init -- so on a fresh machine it does not exist yet and an
# unguarded source made every single shell start with an error.
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
