feat(init): make directory argument optional (#1263)

This commit is contained in:
Marvin Hagemeister
2023-06-10 15:48:02 +02:00
committed by GitHub
parent 12bb00eae1
commit 503bdc384f
5 changed files with 29 additions and 14 deletions
+11 -6
View File
@@ -21,7 +21,7 @@ To generate a project in the current directory:
fresh-init .
USAGE:
fresh-init <DIRECTORY>
fresh-init [DIRECTORY]
OPTIONS:
--force Overwrite existing files
@@ -42,17 +42,22 @@ const flags = parse(Deno.args, {
default: { "force": null, "twind": null, "vscode": null },
});
if (flags._.length !== 1) {
error(help);
}
console.log(
`\n%c 🍋 Fresh: the next-gen web framework. %c\n`,
"background-color: #86efac; color: black; font-weight: bold",
"",
);
const unresolvedDirectory = Deno.args[0];
let unresolvedDirectory = Deno.args[0];
if (flags._.length !== 1) {
const userInput = prompt("Projet Name", "fresh-project");
if (!userInput) {
error(help);
}
unresolvedDirectory = userInput;
}
const resolvedDirectory = resolve(unresolvedDirectory);
try {