Skip to content

Commit 916e24e

Browse files
committed
Add support for multiline descriptions
1 parent c7c62da commit 916e24e

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/node/cli.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ const options: Options<Required<Args>> = {
131131
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
132132
"install-extension": {
133133
type: "string[]",
134-
description:
135-
"Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`. To install a specific version provide `@${version}`. For example: '[email protected]'.",
134+
description: "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" +
135+
"To install a specific version provide `@${version}`. For example: '[email protected]'.",
136136
},
137137
"enable-proposed-api": {
138138
type: "string[]",
@@ -158,8 +158,14 @@ const options: Options<Required<Args>> = {
158158
log: { type: LogLevel },
159159
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
160160

161-
"expose": { type: OptionalString, description: "Expose via Coder Cloud with the passed name. You'll get a URL" +
162-
"like https://myname.coder-cloud.com at which you can easily access your code-server instance. Authorization is done via GitHub." },
161+
"expose": {
162+
type: OptionalString,
163+
description: `
164+
Securely expose code-server via Coder Cloud with the passed name. You'll get a URL like
165+
https://myname.coder-cloud.com at which you can easily access your code-server instance.
166+
Authorization is done via GitHub. Only the first code-server spawned with the current
167+
configuration will be accessible.`
168+
},
163169
}
164170

165171
export const optionDescriptions = (): string[] => {
@@ -172,10 +178,16 @@ export const optionDescriptions = (): string[] => {
172178
{ short: 0, long: 0 },
173179
)
174180
return entries.map(
175-
([k, v]) =>
176-
`${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k}${" ".repeat(
177-
widths.long - k.length,
178-
)} ${v.description}`,
181+
([k, v]) => {
182+
let help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
183+
return help + v.description?.trim().split(/\n/).map((line, i) => {
184+
line = line.trim()
185+
if (i == 0) {
186+
return " ".repeat(widths.long - k.length) + line
187+
}
188+
return " ".repeat(widths.long + widths.short + 6) + line
189+
}).join("\n")
190+
},
179191
)
180192
}
181193

0 commit comments

Comments
 (0)