新 API

警告

此功能是实验性的,可能会发生重大更改。请参阅 Conan 稳定性 部分以获取更多信息。

NewAPI(conan_api)
save_template(template, defines=None, output_folder=None, force=False)

将 ‘template’ 文件保存到 output_folder 中,用 ‘defines’ 替换模板变量。
:param template: 要使用的模板名称
:param defines: 一个包含用于替换模板中 ‘k=v’ 变量的列表
:param output_folder: 模板文件将被保存的文件夹,如果为 None 则为当前工作目录
:param force: 如果为 True,则覆盖已存在的文件,否则抛出错误

get_template(template_folder)

从用户绝对路径文件夹加载模板

get_home_template(template_name)

从 Conan 主目录下的 templates/command/new 文件夹加载模板