Skip to content

Commit 6f82ad0

Browse files
authored
fix: Improve consistency on CLI help (#4112)
This makes the english consistent on flags, and improves the contrast for the placeholder color on dark themes.
1 parent 353fb87 commit 6f82ad0

23 files changed

+101
-74
lines changed

cli/cliflag/cliflag.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818

1919
"github.com/spf13/cobra"
2020
"github.com/spf13/pflag"
21+
22+
"github.com/coder/coder/cli/cliui"
2123
)
2224

2325
// IsSetBool returns the value of the boolean flag if it is set.
@@ -176,7 +178,7 @@ func fmtUsage(u string, env string) string {
176178
if strings.HasSuffix(u, ".") {
177179
dot = ""
178180
}
179-
u = fmt.Sprintf("%s%s\nConsumes $%s", u, dot, env)
181+
u = fmt.Sprintf("%s%s\n"+cliui.Styles.Placeholder.Render("Consumes $%s"), u, dot, env)
180182
}
181183

182184
return u

cli/cliui/cliui.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var Styles = struct {
4848
Field: defaultStyles.Code.Copy().Foreground(lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}),
4949
Keyword: defaultStyles.Keyword,
5050
Paragraph: defaultStyles.Paragraph,
51-
Placeholder: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#585858", Dark: "#005fff"}),
51+
Placeholder: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#585858", Dark: "#4d46b3"}),
5252
Prompt: defaultStyles.Prompt.Foreground(lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"}),
5353
FocusedPrompt: defaultStyles.FocusedPrompt.Foreground(lipgloss.Color("#651fff")),
5454
Fuchsia: defaultStyles.SelectedMenuItem.Copy(),

cli/configssh.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func configSSH() *cobra.Command {
144144
cmd := &cobra.Command{
145145
Annotations: workspaceCommand,
146146
Use: "config-ssh",
147-
Short: "Populate your SSH config with Host entries for all of your workspaces",
147+
Short: "Add an SSH Host entry for your workspaces \"ssh coder.workspace\"",
148148
Example: formatExamples(
149149
example{
150150
Description: "You can use -o (or --ssh-option) so set SSH options to be used for all your workspaces",

cli/create.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func create() *cobra.Command {
2525
cmd := &cobra.Command{
2626
Annotations: workspaceCommand,
2727
Use: "create [name]",
28-
Short: "Create a workspace from a template",
28+
Short: "Create a workspace",
2929
RunE: func(cmd *cobra.Command, args []string) error {
3030
client, err := CreateClient(cmd)
3131
if err != nil {

cli/dotfiles.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func dotfiles() *cobra.Command {
2222
cmd := &cobra.Command{
2323
Use: "dotfiles [git_repo_url]",
2424
Args: cobra.ExactArgs(1),
25-
Short: "Check out and install a dotfiles repository.",
25+
Short: "Checkout and install a dotfiles repository from a Git URL",
2626
Example: formatExamples(
2727
example{
2828
Description: "Check out and install a dotfiles repository without prompts",

cli/features.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
func features() *cobra.Command {
1717
cmd := &cobra.Command{
18-
Short: "List features",
18+
Short: "List Enterprise features",
1919
Use: "features",
2020
Aliases: []string{"feature"},
2121
}

cli/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func list() *cobra.Command {
6666
cmd := &cobra.Command{
6767
Annotations: workspaceCommand,
6868
Use: "list",
69-
Short: "List all workspaces",
69+
Short: "List workspaces",
7070
Aliases: []string{"ls"},
7171
Args: cobra.ExactArgs(0),
7272
RunE: func(cmd *cobra.Command, args []string) error {

cli/login.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func login() *cobra.Command {
4545
)
4646
cmd := &cobra.Command{
4747
Use: "login <url>",
48-
Short: "Authenticate with a Coder deployment",
48+
Short: "Authenticate with Coder deployment",
4949
Args: cobra.ExactArgs(1),
5050
RunE: func(cmd *cobra.Command, args []string) error {
5151
rawURL := args[0]

cli/logout.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
func logout() *cobra.Command {
1515
cmd := &cobra.Command{
1616
Use: "logout",
17-
Short: "Remove the local authenticated session",
17+
Short: "Unauthenticate your local session",
1818
RunE: func(cmd *cobra.Command, args []string) error {
1919
client, err := CreateClient(cmd)
2020
if err != nil {

cli/portforward.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func portForward() *cobra.Command {
3232
)
3333
cmd := &cobra.Command{
3434
Use: "port-forward <workspace>",
35-
Short: "Forward one or more ports from the local machine to the remote workspace",
35+
Short: "Forward ports from machine to a workspace",
3636
Aliases: []string{"tunnel"},
3737
Args: cobra.ExactArgs(1),
3838
Example: formatExamples(

cli/publickey.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func publickey() *cobra.Command {
1818
cmd := &cobra.Command{
1919
Use: "publickey",
2020
Aliases: []string{"pubkey"},
21-
Short: "Output your public key for Git operations",
21+
Short: "Output your Coder public key used for Git operations",
2222
RunE: func(cmd *cobra.Command, args []string) error {
2323
client, err := CreateClient(cmd)
2424
if err != nil {

cli/resetpassword.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func resetPassword() *cobra.Command {
2020

2121
root := &cobra.Command{
2222
Use: "reset-password <username>",
23-
Short: "Reset a user's password by directly updating the database",
23+
Short: "Directly connect to the database to reset a user's password",
2424
Args: cobra.ExactArgs(1),
2525
RunE: func(cmd *cobra.Command, args []string) error {
2626
username := args[0]

cli/root.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -167,21 +167,21 @@ func Root(subcommands []*cobra.Command) *cobra.Command {
167167

168168
cmd.SetUsageTemplate(usageTemplate())
169169

170-
cmd.PersistentFlags().String(varURL, "", "Specify the URL to your deployment.")
170+
cmd.PersistentFlags().String(varURL, "", "URL to a deployment.")
171171
cliflag.Bool(cmd.PersistentFlags(), varNoVersionCheck, "", envNoVersionCheck, false, "Suppress warning when client and server versions do not match.")
172172
cliflag.Bool(cmd.PersistentFlags(), varNoFeatureWarning, "", envNoFeatureWarning, false, "Suppress warnings about unlicensed features.")
173173
cliflag.String(cmd.PersistentFlags(), varToken, "", envSessionToken, "", fmt.Sprintf("Specify an authentication token. For security reasons setting %s is preferred.", envSessionToken))
174-
cliflag.String(cmd.PersistentFlags(), varAgentToken, "", "CODER_AGENT_TOKEN", "", "Specify an agent authentication token.")
174+
cliflag.String(cmd.PersistentFlags(), varAgentToken, "", "CODER_AGENT_TOKEN", "", "An agent authentication token.")
175175
_ = cmd.PersistentFlags().MarkHidden(varAgentToken)
176-
cliflag.String(cmd.PersistentFlags(), varAgentURL, "", "CODER_AGENT_URL", "", "Specify the URL for an agent to access your deployment.")
176+
cliflag.String(cmd.PersistentFlags(), varAgentURL, "", "CODER_AGENT_URL", "", "URL for an agent to access your deployment.")
177177
_ = cmd.PersistentFlags().MarkHidden(varAgentURL)
178-
cliflag.String(cmd.PersistentFlags(), varGlobalConfig, "", "CODER_CONFIG_DIR", configdir.LocalConfig("coderv2"), "Specify the path to the global `coder` config directory.")
178+
cliflag.String(cmd.PersistentFlags(), varGlobalConfig, "", "CODER_CONFIG_DIR", configdir.LocalConfig("coderv2"), "Path to the global `coder` config directory.")
179179
cliflag.StringArray(cmd.PersistentFlags(), varHeader, "", "CODER_HEADER", []string{}, "HTTP headers added to all requests. Provide as \"Key=Value\"")
180180
cmd.PersistentFlags().Bool(varForceTty, false, "Force the `coder` command to run as if connected to a TTY.")
181181
_ = cmd.PersistentFlags().MarkHidden(varForceTty)
182182
cmd.PersistentFlags().Bool(varNoOpen, false, "Block automatically opening URLs in the browser.")
183183
_ = cmd.PersistentFlags().MarkHidden(varNoOpen)
184-
cliflag.Bool(cmd.PersistentFlags(), varVerbose, "v", "CODER_VERBOSE", false, "Enable verbose output")
184+
cliflag.Bool(cmd.PersistentFlags(), varVerbose, "v", "CODER_VERBOSE", false, "Enable verbose output.")
185185

186186
return cmd
187187
}

cli/schedule.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func schedules() *cobra.Command {
5757
scheduleCmd := &cobra.Command{
5858
Annotations: workspaceCommand,
5959
Use: "schedule { show | start | stop | override } <workspace>",
60-
Short: "Modify scheduled stop and start times for your workspace",
60+
Short: "Schedule automated start and stop times for workspaces",
6161
}
6262

6363
scheduleCmd.AddCommand(

0 commit comments

Comments
 (0)