Reversivly create command templates.

def _get_command_templates(command_tokens, files=[], paths=[], job_options=[],
    count=1):
    """ Reversivly create command templates. """
    if not command_tokens:
        return []

    comment_tokens, command_token = command_tokens.pop()
    parts = []

    parts += job_options + _get_comments(comment_tokens)
    for part in command_token[0]:
        # Check for file
        try:
            parts.append(_get_file_by_alias(part, files))
            continue
        except (AttributeError, ValueError):
            pass

        # Check for path/string
        for cut in part.split():
            try:
                parts.append(_get_path_by_name(cut, paths))
                continue
            except ValueError:
                pass

            parts.append(cut)

    command_template = CommandTemplate(alias=str(count), parts=parts)
    [setattr(p, 'alias', command_template.alias)
        for p in command_template.output_parts]
    return [command_template] + _get_command_templates(command_tokens,
        files, paths, job_options, count+1)