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 鍵
  • 在 track 的config.json檔案裡:
    • 檢查或更新練習的難度
    • 把概念加到 concepts 鍵
    • 把概念加到 prerequisites 鍵

建立解題思路

要建立解題思路的檔案,必須指定解題思路和它所屬練習的 slug:

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

這會依解題思路文件的規定,建立解題思路所需的檔案。

建立文章

要建立文章的檔案,必須指定文章和它所屬練習的 slug:

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

這會依文章文件的規定,建立文章所需的檔案。