MCPcopy Create free account
hub / github.com/Tatamo/atcoder-cli / getTemplate

Function getTemplate

src/template.ts:38–46  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

36 * @throws Error バリデーションに失敗、またはファイル・ディレクトリが存在しない場合エラーとなる
37 */
38export async function getTemplate(name: string): Promise<Template> {
39 const configdir = await getConfigDirectory();
40 const template = JSON.parse(await promisify(readFile)(resolve(configdir, name, TEMPLATE_JSON_FILE_NAME), "utf8"));
41 const [valid, error] = await validateTemplateJSON(template);
42 if (!valid) {
43 throw new Error(error!);
44 }
45 return {name, ...template};
46}
47
48/**
49 * コンフィグディレクトリ全体を走査してテンプレートディレクトリを取得する

Callers 2

getTemplateFromOptionFunction · 0.90
getTemplatesFunction · 0.85

Calls 2

getConfigDirectoryFunction · 0.90
validateTemplateJSONFunction · 0.85

Tested by

no test coverage detected