Skip to content

Commit a5b6d08

Browse files
committedOct 9, 2020
Add CS_BETA and note --coder-bind is in beta
1 parent 9ff3797 commit a5b6d08

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed
 

‎src/node/cli.ts

+31-21
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ interface Option<T> {
6767
description?: string
6868

6969
/**
70-
* Whether to print this option in --help output
70+
* If marked as beta, the option is not printed unless $CS_BETA is set.
7171
*/
72-
hidden?: boolean
72+
beta?: boolean
7373
}
7474

7575
type OptionType<T> = T extends boolean
@@ -170,8 +170,10 @@ const options: Options<Required<Args>> = {
170170
Securely bind code-server via Coder Cloud with the passed name. You'll get a URL like
171171
https://myname.coder-cloud.com at which you can easily access your code-server instance.
172172
Authorization is done via GitHub.
173+
This is presently beta and requires being accepted for testing.
174+
See https://github.com/cdr/code-server/discussions/2137
173175
`,
174-
hidden: true,
176+
beta: true,
175177
},
176178
}
177179

@@ -184,24 +186,32 @@ export const optionDescriptions = (): string[] => {
184186
}),
185187
{ short: 0, long: 0 },
186188
)
187-
return entries.filter(([_, v]) => !v.hidden).map(([k, v]) => {
188-
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
189-
return (
190-
help +
191-
v.description
192-
?.trim()
193-
.split(/\n/)
194-
.map((line, i) => {
195-
line = line.trim()
196-
if (i === 0) {
197-
return " ".repeat(widths.long - k.length) + line
198-
}
199-
return " ".repeat(widths.long + widths.short + 6) + line
200-
})
201-
.join("\n") +
202-
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
203-
)
204-
})
189+
return entries
190+
.filter(([, v]) => {
191+
// If CS_BETA is set, we show beta options but if not, then we do not want
192+
// to show beta options.
193+
return process.env.CS_BETA || !v.beta
194+
})
195+
.map(([k, v]) => {
196+
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${
197+
v.short ? `-${v.short}` : " "
198+
} --${k} `
199+
return (
200+
help +
201+
v.description
202+
?.trim()
203+
.split(/\n/)
204+
.map((line, i) => {
205+
line = line.trim()
206+
if (i === 0) {
207+
return " ".repeat(widths.long - k.length) + line
208+
}
209+
return " ".repeat(widths.long + widths.short + 6) + line
210+
})
211+
.join("\n") +
212+
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
213+
)
214+
})
205215
}
206216

207217
export const parse = (

‎src/node/coder-cloud.ts

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ function runAgent(...args: string[]): Promise<void> {
3333
}
3434

3535
export function coderCloudBind(csAddr: string, serverName = ""): Promise<void> {
36+
logger.info("Remember --coder-bind is a beta feature and requires being accepted for testing")
37+
logger.info("See https://github.com/cdr/code-server/discussions/2137")
3638
// addr needs to be in host:port format.
3739
// So we trim the protocol.
3840
csAddr = csAddr.replace(/^https?:\/\//, "")

0 commit comments

Comments
 (0)
Please sign in to comment.