Skip to content

Commit 02a210b

Browse files
authored
fix: improve documentation for boolean script arguments (#21)
1 parent bf41381 commit 02a210b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

lib/create-readme.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,24 @@ ${usage}
6767
`;
6868

6969
Object.entries(scriptOptions).forEach(
70-
([name, { type, required, description }]) => {
71-
content += `| \`--${decamelize(name, {
70+
([name, { type, required, description, default: defaultValue }]) => {
71+
const CliOption = decamelize(name, {
7272
separator: "-",
73-
})}\` | ${type} | ${required ? `**(required)**` : ""} ${description} |
73+
});
74+
let optionNames = `\`--${CliOption}\``;
75+
if (type === "boolean") {
76+
optionNames += ` or \`--no-${CliOption}\``;
77+
}
78+
79+
content += `| ${optionNames} | ${type} | ${
80+
required ? `**(required)**` : ""
81+
} ${description} ${
82+
defaultValue
83+
? `. Defaults to ${
84+
type === "string" ? `"${defaultValue}"` : defaultValue
85+
}`
86+
: ""
87+
} |
7488
`;
7589
}
7690
);

lib/prompts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default async function prompts({
142142
{
143143
type: "input",
144144
name: "path",
145-
message: `Folder path to initialize the project in, relative to current path. If the path it does not yet exist it will be created. Current path is ${process.cwd()})`,
145+
message: `Folder path to initialize the project in, relative to current path. If the path does not yet exist it will be created. Current path is ${process.cwd()})`,
146146
default: () => answers1.repository.split("/")[1],
147147
},
148148
]);

0 commit comments

Comments
 (0)