'Restore original sys.argv from COMP_LINE in the case that starcluster
is being called by Bash/ZSH for completion options. Bash/ZSH will
simply call \'starcluster\' with COMP_LINE environment variable set to
the current (partial) argv for completion.
StarCluster\'s Bash/ZSH completion code needs to read the global config
option in case an alternate config is specified at the command line
when completing options. StarCluster\'s completion code uses the config
to generate completion options. Setting sys.argv to $COMP_LINE in this
case allows the global option parser to be used to extract the global
-c option (if specified) and load the proper config in the completion
code.'

def _init_completion(self):

    if ('COMP_LINE' in os.environ):
        newargv = shlex.split(os.environ.get('COMP_LINE'))
        for (i, arg) in enumerate(newargv):
            arg = os.path.expanduser(arg)
            newargv[i] = os.path.expandvars(arg)
        sys.argv = newargv
