Skip to content

cli: Show beta flags in help output #2427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ When done, the install script prints out instructions for running and starting c

We also have an in-depth [setup and configuration](./doc/guide.md) guide.

### Alpha Program 🐣
### Cloud Program ☁️

We're working on a cloud platform that makes deploying and managing code-server easier.
Consider updating to the latest version and running code-server with our experimental 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
- Authentication
Expand Down
48 changes: 19 additions & 29 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ interface Option<T> {
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
}
Expand Down Expand Up @@ -193,8 +193,6 @@ const options: Options<Required<Args>> = {
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.
This is presently beta and requires being accepted for testing.
See https://github.com/cdr/code-server/discussions/2137
`,
beta: true,
},
Expand All @@ -209,32 +207,24 @@ export const optionDescriptions = (): string[] => {
}),
{ short: 0, long: 0 },
)
return entries
.filter(([, v]) => {
// 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 (
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") +
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
)
})
return entries.map(([k, v]) => {
const 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) + (v.beta ? "(beta) " : "") + line
}
return " ".repeat(widths.long + widths.short + 6) + line
})
.join("\n") +
(typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "")
)
})
}

export const parse = (
Expand Down