#!/bin/bash

INPUT_ARGS=$@

if [[ $@ =~ '--python2' ]]; then
    INPUT_ARGS=${@//--python2/}
    source /usr/share/trex-core/scripts/find_python.sh --python2
fi

if [[ $@ =~ '--python3' ]]; then
    INPUT_ARGS=${@//--python3/}
    source /usr/share/trex-core/scripts/find_python.sh --python3
fi

if [ -z "$PYTHON" ]; then
    source /usr/share/trex-core/scripts/find_python.sh
fi

export PYTHONPATH=/usr/share/trex-core/scripts/automation/trex_control_plane/interactive

printf "\nUsing '$PYTHON' as Python interpeter\n\n"

$PYTHON -m trex.console.trex_console $INPUT_ARGS
