Beispiel #1
0
def get_comment(filename, msg):
    if filename.endswith('.cmake') or filename.endswith('.py'):
        line_prefix = '#'
    else:
        line_prefix = '//'

    comment = ''
    index = 0
    while True:
        new_index = get_index_of_next_line(msg, index)
        if new_index == index:
            break
        comment += line_prefix
        line = msg[index:new_index]
        if line.splitlines()[0]:
            comment += ' '
        comment += line
        index = new_index
    return comment
Beispiel #2
0
def get_comment(filename, msg):
    if filename.endswith('.cmake') or filename.endswith('.py'):
        line_prefix = '#'
    else:
        line_prefix = '//'

    comment = ''
    index = 0
    while True:
        new_index = get_index_of_next_line(msg, index)
        if new_index == index:
            break
        comment += line_prefix
        line = msg[index:new_index]
        if line.splitlines()[0]:
            comment += ' '
        comment += line
        index = new_index
    return comment