#!/bin/bash
# The trick to this all working is this wrapper that you
# source in rather than execute. i.e. `. archelon`. This
# will run the python interface and interactively drop the command
# entered

# Dump history and update server with latest if configured
history -a
archelon_update
if [ $? -ne 0 ]; then
    echo "Server update failed, check configuration/server."
fi

archelonf
rc=$?

if [ $rc -eq 0 ]; then
    cmd=$(cat ~/.archelon_cmd)
    # Add to history
    history -s $cmd
    # Run it
    eval $cmd
fi
