You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
960 B

3 days ago
# -*- coding: utf-8 -*-
"""票 06 关票:Status claimed→resolved + answer06.md 追加为 Answer 段(沿用票 07 模式)。"""
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
TICKET = r'd:\code\crm-backend-matt\.scratch\customer-e2e\issues\06-bruno-docs.md'
ANSWER = r'd:\code\crm-backend-matt\.scratch\customer-e2e\answer06.md'
txt = open(TICKET, encoding='utf-8').read()
if 'Status: claimed' in txt:
txt = txt.replace('Status: claimed', 'Status: resolved', 1)
print('status: claimed -> resolved')
else:
print('WARN: status line not in expected state:', [l for l in txt.splitlines() if 'Status' in l])
answer = open(ANSWER, encoding='utf-8').read().rstrip()
if '## Answer' in txt:
print('WARN: Answer already present, skip append')
else:
txt = txt.rstrip() + '\n\n' + answer + '\n'
print('answer appended')
open(TICKET, 'w', encoding='utf-8', newline='').write(txt)
print('ticket saved.')