Skip to content

Commit d353e1d

Browse files
committed
feat: custom lang
1 parent 6aa3b4b commit d353e1d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/cli.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,25 @@ const onLoad = async (targetDir, version, argv) => {
6767
if (skipPrompts) {
6868
return;
6969
}
70+
langsList.splice(1, 0, { title: "Enter custom", value: "custom" });
7071
const questions = [
7172
{
7273
type: "autocomplete",
73-
name: "langAnswer",
74+
name: "lang",
7475
message: "Select language",
7576
choices: langsList,
7677
},
7778
];
7879

79-
const { lang } = await prompts(questions);
80+
let { lang } = await prompts(questions);
81+
if (lang === "custom") {
82+
let { customLang } = await prompts({
83+
type: "text",
84+
name: "customLang",
85+
message: "Enter custom language code",
86+
});
87+
lang = customLang;
88+
}
8089
try {
8190
const indexFile = targetDir + "/index.html";
8291
const sourceHTML = await fs.readFile(indexFile, "utf-8");

0 commit comments

Comments
 (0)