#!/usr/bin/env python
import argcomplete
import argparse
import imp
import os

pathname = os.path.dirname(os.path.abspath(__file__))
DSET = os.path.join(os.path.abspath(pathname), 'dset')
dset = imp.load_source('dset', DSET) 
DCONTAINER = os.path.join(os.path.abspath(pathname), 'dcontainer')
dcontainer = imp.load_source('dcontainer', DCONTAINER)

parser = argparse.ArgumentParser(description='Run karaf client')
parser.add_argument("container", help="container name", nargs='?')
argcomplete.autocomplete(parser)
args = parser.parse_args()

dset.call("docker exec -e COLUMNS=\"`tput cols`\" -e LINES=\"`tput lines`\"  -it {} dclient".format(dcontainer.get_container(args.container)))
