Skip to content

Commit eca1c63

Browse files
chore: address review feedback for GitHub import selection prompt
Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
1 parent cac8518 commit eca1c63

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

script.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ This is a fully client-side application. Your content never leaves your browser
817817
function isMarkdownPath(path) {
818818
return /\.(md|markdown)$/i.test(path || "");
819819
}
820+
const MAX_GITHUB_FILES_SHOWN = 30;
820821

821822
function getFileName(path) {
822823
return (path || "").split("/").pop() || "document.md";
@@ -958,20 +959,20 @@ This is a fully client-side application. Your content never leaves your browser
958959

959960
let targetPath = files[0];
960961
if (files.length > 1) {
961-
const maxShown = Math.min(files.length, 30);
962+
const maxShown = Math.min(files.length, MAX_GITHUB_FILES_SHOWN);
962963
const choices = files
963964
.slice(0, maxShown)
964965
.map((file, index) => `${index + 1}. ${file}`)
965966
.join("\n");
966967
const choice = prompt(
967-
`Found ${files.length} Markdown files.\nEnter a number to import:\n\n${choices}${files.length > maxShown ? "\n..." : ""}`,
968+
`Found ${files.length} Markdown files.\nEnter a number to import (showing first ${maxShown}):\n\n${choices}${files.length > maxShown ? "\n..." : ""}`,
968969
"1"
969970
);
970971

971972
if (choice === null) return;
972973
const selectedIndex = Number(choice) - 1;
973974
if (!Number.isInteger(selectedIndex) || selectedIndex < 0 || selectedIndex >= maxShown) {
974-
throw new Error(`Please enter a number between 1 and ${maxShown}.`);
975+
throw new Error(`Please enter a number between 1 and ${maxShown} (from the displayed list).`);
975976
}
976977
targetPath = files[selectedIndex];
977978
}

0 commit comments

Comments
 (0)