Add support for multiline descriptions
This commit is contained in:
parent
c7c62daa67
commit
916e24e109
|
@ -131,8 +131,8 @@ const options: Options<Required<Args>> = {
|
|||
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
|
||||
"install-extension": {
|
||||
type: "string[]",
|
||||
description:
|
||||
"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: 'vscode.csharp@1.2.3'.",
|
||||
description: "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" +
|
||||
"To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.",
|
||||
},
|
||||
"enable-proposed-api": {
|
||||
type: "string[]",
|
||||
|
@ -158,8 +158,14 @@ const options: Options<Required<Args>> = {
|
|||
log: { type: LogLevel },
|
||||
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
|
||||
|
||||
"expose": { type: OptionalString, description: "Expose via Coder Cloud with the passed name. You'll get a URL" +
|
||||
"like https://myname.coder-cloud.com at which you can easily access your code-server instance. Authorization is done via GitHub." },
|
||||
"expose": {
|
||||
type: OptionalString,
|
||||
description: `
|
||||
Securely expose code-server via Coder Cloud with the passed name. You'll get a URL like
|
||||
https://myname.coder-cloud.com at which you can easily access your code-server instance.
|
||||
Authorization is done via GitHub. Only the first code-server spawned with the current
|
||||
configuration will be accessible.`
|
||||
},
|
||||
}
|
||||
|
||||
export const optionDescriptions = (): string[] => {
|
||||
|
@ -172,10 +178,16 @@ export const optionDescriptions = (): string[] => {
|
|||
{ short: 0, long: 0 },
|
||||
)
|
||||
return entries.map(
|
||||
([k, v]) =>
|
||||
`${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k}${" ".repeat(
|
||||
widths.long - k.length,
|
||||
)} ${v.description}`,
|
||||
([k, v]) => {
|
||||
let help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
|
||||
return help + v.description?.trim().split(/\n/).map((line, i) => {
|
||||
line = line.trim()
|
||||
if (i == 0) {
|
||||
return " ".repeat(widths.long - k.length) + line
|
||||
}
|
||||
return " ".repeat(widths.long + widths.short + 6) + line
|
||||
}).join("\n")
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue