#!/usr/bin/python

import os
from string import replace
import sys

# TODO
#
# This is a temporary dummy script to simulate how you break out within
# the interactive CLI so we can get existing automation to work
# before and after the switch-over to changing the default user shell

if len(sys.argv) < 2 or sys.argv[1] != "shell":
    sys.exit(1)
elif len(sys.argv) == 2:
    os.execv("/bin/bash", ["-i"])
else:
    # Escape spaces in args and join into single strings
    args = " ".join([replace(replace(arg, " ", "\ "), "\t", "\\\t")
                     for arg in sys.argv[2:]])
    os.execv("/bin/bash", ["/bin/bash", "-c"] + [args])
