#!/usr/bin/env bash
# .bashrc

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

function _bashrc_main {
    local BASH_CONFIG_DIR=~/.config/bash
    # source a file in $BASH_CONFIG_DIR
    function _load {
        if [ -f "$BASH_CONFIG_DIR/$1" ]; then
            source "$BASH_CONFIG_DIR/$1"
        else
            echo "Missing bash config file: $1" >&2
        fi
    }
    function _exists {
        type $1 &> /dev/null
    }
    # load custom settings
    _load custom
    unset -f _load
    unset -f _exists
}

_bashrc_main
unset -f _bashrc_main
# =====<end of .bashrc>=====
