configlet create


添加新的解题思路、文章或练习时,你需要创建一些名称有严格规定的文件,同时还要添加或更新相应的配置文件。有了create命令,configlet 就能帮你完成这一切。

用法

create命令可以用来创建添加新解题思路、文章或练习所需的文件,也可以修改相关的配置文件。

configlet [global-options] create [command-options]

Options for create:
      --approach <slug>           The slug of the approach
      --article <slug>            The slug of the article
      --practice-exercise <slug>  The slug of the practice exercise
      --concept-exercise <slug>   The slug of the concept exercise
  -e, --exercise <slug>           Only operate on this exercise
  -o, --offline                   Do not update the cached 'problem-specifications' data

创建实践练习

添加实践练习的文档详细说明了如何添加一个实践练习。

创建概念练习

要创建概念练习,需要指定它的 slug:

configlet create --concept-exercise bird-watcher

这会按照概念练习文档中的规定,创建概念练习所需的文件。

当然,这只是创建一个练习的第一步。接下来你还需要:

  • 往测试文件中添加测试
  • 添加一个示例实现
  • 定义存根文件的内容
  • 在.docs/introduction.md中编写简介
  • 在.docs/instructions.md中编写说明
  • 在练习的.meta/config.json文件中:
    • 把练习作者的 GitHub 用户名添加到authors键中
  • 在学习路径的config.json文件中:
    • 检查/更新练习的难度
    • 把概念添加到concepts键中
    • 把概念添加到prerequisites键中

创建解题思路

要创建解题思路的文件,需要指定解题思路及其练习的 slug:

configlet create --approach recursion --exercise collatz-conjecture

这会按照解题思路文档中的规定,创建解题思路所需的文件。

创建文章

要创建文章的文件,需要指定文章及其练习的 slug:

configlet create --article performance --exercise collatz-conjecture

这会按照文章文档中的规定,创建文章所需的文件。