Archived
1
0

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
This commit is contained in:
Anmol Sethi 2020-12-08 18:38:20 -05:00
parent 6c693000eb
commit affb92f281
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
2 changed files with 21 additions and 28 deletions

View File

@ -36,7 +36,7 @@ We also have an in-depth [setup and configuration](./doc/guide.md) guide.
### Cloud Program ☁️ ### Cloud Program ☁️
We're working on a cloud platform that makes deploying and managing code-server easier. We're working on a cloud platform that makes deploying and managing code-server easier.
Consider running code-server with the flag `--link` if you don't want to worry about Consider running code-server with the beta flag `--link` if you don't want to worry about
- TLS - TLS
- Authentication - Authentication

View File

@ -74,7 +74,7 @@ interface Option<T> {
description?: string description?: string
/** /**
* If marked as beta, the option is not printed unless $CS_BETA is set. * If marked as beta, the option is marked as beta in help.
*/ */
beta?: boolean beta?: boolean
} }
@ -194,6 +194,7 @@ const options: Options<Required<Args>> = {
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.
`, `,
beta: true,
}, },
} }
@ -206,16 +207,8 @@ export const optionDescriptions = (): string[] => {
}), }),
{ short: 0, long: 0 }, { short: 0, long: 0 },
) )
return entries return entries.map(([k, v]) => {
.filter(([, v]) => { const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} `
// If CS_BETA is set, we show beta options but if not, then we do not want
// to show beta options.
return process.env.CS_BETA || !v.beta
})
.map(([k, v]) => {
const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${
v.short ? `-${v.short}` : " "
} --${k} `
return ( return (
help + help +
v.description v.description
@ -224,7 +217,7 @@ export const optionDescriptions = (): string[] => {
.map((line, i) => { .map((line, i) => {
line = line.trim() line = line.trim()
if (i === 0) { if (i === 0) {
return " ".repeat(widths.long - k.length) + line return " ".repeat(widths.long - k.length) + (v.beta ? "(beta) " : "") + line
} }
return " ".repeat(widths.long + widths.short + 6) + line return " ".repeat(widths.long + widths.short + 6) + line
}) })