Skip to content

Commit 8272dca

Browse files
nhooyrJoe Previte
authored and
Joe Previte
committed
cli: Show beta flags in help output
Looks like ``` -r --reuse-window Force to open a file or folder in an already opened window. -vvv --verbose Enable verbose logging. --link (beta) 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. Authorization is done via GitHub. ``` Based on commits by @JammSpread in #2405 Closes #2396
1 parent 35d68eb commit 8272dca

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ We also have an in-depth [setup and configuration](./doc/guide.md) guide.
3636
### Cloud Program ☁️
3737

3838
We're working on a cloud platform that makes deploying and managing code-server easier.
39-
Consider running code-server with the flag `--link` if you don't want to worry about
39+
Consider running code-server with the beta flag `--link` if you don't want to worry about
4040

4141
- TLS
4242
- Authentication

src/node/cli.ts

+20-27
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ interface Option<T> {
7575
description?: string
7676

7777
/**
78-
* If marked as beta, the option is not printed unless $CS_BETA is set.
78+
* If marked as beta, the option is marked as beta in help.
7979
*/
8080
beta?: boolean
8181
}
@@ -195,6 +195,7 @@ const options: Options<Required<Args>> = {
195195
https://myname.coder-cloud.com at which you can easily access your code-server instance.
196196
Authorization is done via GitHub.
197197
`,
198+
beta: true,
198199
},
199200
home: {
200201
type: "string",
@@ -211,32 +212,24 @@ export const optionDescriptions = (): string[] => {
211212
}),
212213
{ short: 0, long: 0 },
213214
)
214-
return entries
215-
.filter(([, v]) => {
216-
// If CS_BETA is set, we show beta options but if not, then we do not want
217-
// to show beta options.
218-
return process.env.CS_BETA || !v.beta
219-
})
220-
.map(([k, v]) => {
221-
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${
222-
v.short ? `-${v.short}` : " "
223-
} --${k} `
224-
return (
225-
help +
226-
v.description
227-
?.trim()
228-
.split(/\n/)
229-
.map((line, i) => {
230-
line = line.trim()
231-
if (i === 0) {
232-
return " ".repeat(widths.long - k.length) + line
233-
}
234-
return " ".repeat(widths.long + widths.short + 6) + line
235-
})
236-
.join("\n") +
237-
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
238-
)
239-
})
215+
return entries.map(([k, v]) => {
216+
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
217+
return (
218+
help +
219+
v.description
220+
?.trim()
221+
.split(/\n/)
222+
.map((line, i) => {
223+
line = line.trim()
224+
if (i === 0) {
225+
return " ".repeat(widths.long - k.length) + (v.beta ? "(beta) " : "") + line
226+
}
227+
return " ".repeat(widths.long + widths.short + 6) + line
228+
})
229+
.join("\n") +
230+
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
231+
)
232+
})
240233
}
241234

242235
export const parse = (

0 commit comments

Comments
 (0)