新 API¶
警告
此功能是实验性的,可能会发生重大更改。有关更多信息,请参阅 Conan 的稳定性 部分。
- class 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 文件夹加载模板