Skip to content

Commit 67ef27a

Browse files
committed
feat: enhance tool listing to support ordered extra tools
1 parent f59d6ad commit 67ef27a

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

src/index.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,19 @@ function logHelpMessage(
105105
templates: string[],
106106
extraTools?: ExtraTool[],
107107
) {
108-
const extraToolNames = extraTools?.map((tool) => tool.value) ?? [];
109-
const toolsList = [...BUILTIN_TOOLS, ...extraToolNames].join(', ');
108+
const toolsList = [...BUILTIN_TOOLS];
109+
if (extraTools) {
110+
for (const tool of extraTools) {
111+
if (!tool.value) {
112+
continue;
113+
}
114+
if (tool.order === 'pre') {
115+
toolsList.unshift(tool.value);
116+
} else {
117+
toolsList.push(tool.value);
118+
}
119+
}
120+
}
110121

111122
logger.log(`
112123
Usage: create-${name} [dir] [options]
@@ -116,13 +127,15 @@ function logHelpMessage(
116127
-h, --help display help for command
117128
-d, --dir <dir> create project in specified directory
118129
-t, --template <tpl> specify the template to use
119-
--tools <tool> select additional tools (${toolsList})
130+
--tools <tool> add additional tools, comma separated
120131
--override override files in target directory
121132
--packageName <name> specify the package name
122133
123-
Templates:
124-
134+
Available templates:
125135
${templates.join(', ')}
136+
137+
Optional tools:
138+
${toolsList.join(', ')}
126139
`);
127140
}
128141

0 commit comments

Comments
 (0)