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

Add CS_BETA and note --coder-bind is in beta

上级 9ff37977
...@@ -67,9 +67,9 @@ interface Option<T> { ...@@ -67,9 +67,9 @@ interface Option<T> {
description?: string description?: string
/** /**
* Whether to print this option in --help output * If marked as beta, the option is not printed unless $CS_BETA is set.
*/ */
hidden?: boolean beta?: boolean
} }
type OptionType<T> = T extends boolean type OptionType<T> = T extends boolean
...@@ -170,8 +170,10 @@ const options: Options<Required<Args>> = { ...@@ -170,8 +170,10 @@ const options: Options<Required<Args>> = {
Securely bind code-server via Coder Cloud with the passed name. You'll get a URL like Securely bind 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. https://myname.coder-cloud.com at which you can easily access your code-server instance.
Authorization is done via GitHub. Authorization is done via GitHub.
This is presently beta and requires being accepted for testing.
See https://github.com/cdr/code-server/discussions/2137
`, `,
hidden: true, beta: true,
}, },
} }
...@@ -184,24 +186,32 @@ export const optionDescriptions = (): string[] => { ...@@ -184,24 +186,32 @@ export const optionDescriptions = (): string[] => {
}), }),
{ short: 0, long: 0 }, { short: 0, long: 0 },
) )
return entries.filter(([_, v]) => !v.hidden).map(([k, v]) => { return entries
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} ` .filter(([, v]) => {
return ( // If CS_BETA is set, we show beta options but if not, then we do not want
help + // to show beta options.
v.description return process.env.CS_BETA || !v.beta
?.trim() })
.split(/\n/) .map(([k, v]) => {
.map((line, i) => { const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${
line = line.trim() v.short ? `-${v.short}` : " "
if (i === 0) { } --${k} `
return " ".repeat(widths.long - k.length) + line return (
} help +
return " ".repeat(widths.long + widths.short + 6) + line v.description
}) ?.trim()
.join("\n") + .split(/\n/)
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "") .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") +
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
)
})
} }
export const parse = ( export const parse = (
......
...@@ -33,6 +33,8 @@ function runAgent(...args: string[]): Promise<void> { ...@@ -33,6 +33,8 @@ function runAgent(...args: string[]): Promise<void> {
} }
export function coderCloudBind(csAddr: string, serverName = ""): Promise<void> { export function coderCloudBind(csAddr: string, serverName = ""): Promise<void> {
logger.info("Remember --coder-bind is a beta feature and requires being accepted for testing")
logger.info("See https://github.com/cdr/code-server/discussions/2137")
// addr needs to be in host:port format. // addr needs to be in host:port format.
// So we trim the protocol. // So we trim the protocol.
csAddr = csAddr.replace(/^https?:\/\//, "") csAddr = csAddr.replace(/^https?:\/\//, "")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册