產生文件


configlet 的次要用途是產生文件。

使用方式

generate 指令可以用來從範本產生 instructions/introductions 文件。

configlet [global-options] generate

Global options:
  -h, --help                   Show this help message and exit
      --version                Show this tool's version information and exit
  -t, --track-dir <dir>        Specify a track directory to use instead of the current directory
  -v, --verbosity <verbosity>  The verbosity of output. Allowed values: q[uiet], n[ormal], d[etailed]

文件

以下是 configlet 可以產生的文件。

文件:概念練習的 introduction.md 檔案

每個概念練習都有一份introduction.md檔案。每個練習可以選擇性地提供一份introduction.md.tpl檔案。

範本檔案應視為一般的 Markdown 檔案,但多了一項功能:可以指定佔位符。支援以下佔位符:

當 configlet 偵測到某個概念練習有introduction.md.tpl檔案時,就會根據它產生一份introduction.md檔案。產生的 introduction 內容會與範本相同,只有佔位符例外,它們會被替換成所指向文件的內容。

文件:練習題的 introduction.md 檔案

當 configlet 偵測到某個練習題實作了某個含有introduction.md檔案的 Problem Specifications 練習時,configlet 會將該練習題的.meta/introduction.md檔案與該 Problem Specifications 練習的introduction.md檔案同步。

文件:練習題的 instructions.md 檔案

當 configlet 偵測到某個練習題實作了某個 Problem Specifications 練習時,configlet 會將該練習題的.meta/instructions.md檔案與該 Problem Specifications 練習的instructions.md檔案同步;若找不到instructions.md檔案,則改與它的description.md檔案同步。

文件:練習題的 .meta/config.json 檔案

當 configlet 偵測到某個練習題實作了某個 Problem Specifications 練習時,configlet 會將該 Problem Specifications 練習metadata.yml檔案中的source和source_url鍵,同步到練習題.meta/config.json檔案中的source和source_url屬性。