未验证 提交 916e24e1 编写于 作者: A Anmol Sethi

Add support for multiline descriptions

上级 c7c62daa
......@@ -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")
},
)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册