提交 55555865 编写于 作者: M Mars Liu

nodes init

上级 41bfb9e4
{
"keywords": []
"keywords": [],
"node_id": "c-1cf412c0785c4269a2a4cc7634aa101b",
"title": "GIT入门"
}
\ No newline at end of file
{
"keywords": []
"keywords": [],
"node_id": "c-5995c3ccf1554d1ca4e48da52cf6aed9",
"title": "toolchains初阶"
}
\ No newline at end of file
{
"keywords": []
"keywords": [],
"node_id": "c-671b93fb441b44bd86020a6c5ecb689b",
"title": "toolchains中阶"
}
\ No newline at end of file
{
"keywords": []
"keywords": [],
"node_id": "c-60527be7abb340d39a1d4a4e780b402c",
"title": "toolchains高阶"
}
\ No newline at end of file
{
"tree_name": "Toolchains",
"keywords": [],
"node_id": "c-9ae45d2c41cd4958a449b8f50a394fcc",
"title": "C"
}
\ No newline at end of file
{
"Toolchains": {
"node_id": "c-9ae45d2c41cd4958a449b8f50a394fcc",
"keywords": [],
"children": [
{
"toolchains初阶": {
"node_id": "c-5995c3ccf1554d1ca4e48da52cf6aed9",
"keywords": [],
"children": [
{
"GIT入门": {
"node_id": "c-1cf412c0785c4269a2a4cc7634aa101b",
"keywords": [],
"children": []
}
}
]
}
},
{
"toolchains中阶": {
"node_id": "c-671b93fb441b44bd86020a6c5ecb689b",
"keywords": [],
"children": []
}
},
{
"toolchains高阶": {
"node_id": "c-60527be7abb340d39a1d4a4e780b402c",
"keywords": [],
"children": []
}
}
]
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ def dump_json(p, j, exist_ok=False, override=False):
print(f"{p} already exist")
sys.exit(0)
with open(p, 'w') as f:
with open(p, 'w+') as f:
f.write(json.dumps(j, indent=2, ensure_ascii=False))
......@@ -117,7 +117,7 @@ def gen_tree(data_path):
cfg_path = os.path.join(data_path, 'config.json')
cfg = load_json(cfg_path)
if ensure_node_id(cfg):
dump_json(cfg_path, cfg)
dump_json(cfg_path, cfg, exist_ok=True, override=True)
if ensure_title(cfg, cfg_path):
cfg["title"] = "C"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册