Skip to content

fix: Improve consistency on CLI help #4112

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 1 commit into from
Sep 19, 2022
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: 3 additions & 1 deletion cli/cliflag/cliflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/coder/coder/cli/cliui"
)

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

return u
Expand Down
2 changes: 1 addition & 1 deletion cli/cliui/cliui.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var Styles = struct {
Field: defaultStyles.Code.Copy().Foreground(lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}),
Keyword: defaultStyles.Keyword,
Paragraph: defaultStyles.Paragraph,
Placeholder: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#585858", Dark: "#005fff"}),
Placeholder: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#585858", Dark: "#4d46b3"}),
Prompt: defaultStyles.Prompt.Foreground(lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"}),
FocusedPrompt: defaultStyles.FocusedPrompt.Foreground(lipgloss.Color("#651fff")),
Fuchsia: defaultStyles.SelectedMenuItem.Copy(),
Expand Down
2 changes: 1 addition & 1 deletion cli/configssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func configSSH() *cobra.Command {
cmd := &cobra.Command{
Annotations: workspaceCommand,
Use: "config-ssh",
Short: "Populate your SSH config with Host entries for all of your workspaces",
Short: "Add an SSH Host entry for your workspaces \"ssh coder.workspace\"",
Example: formatExamples(
example{
Description: "You can use -o (or --ssh-option) so set SSH options to be used for all your workspaces",
Expand Down
2 changes: 1 addition & 1 deletion cli/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func create() *cobra.Command {
cmd := &cobra.Command{
Annotations: workspaceCommand,
Use: "create [name]",
Short: "Create a workspace from a template",
Short: "Create a workspace",
RunE: func(cmd *cobra.Command, args []string) error {
client, err := CreateClient(cmd)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/dotfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func dotfiles() *cobra.Command {
cmd := &cobra.Command{
Use: "dotfiles [git_repo_url]",
Args: cobra.ExactArgs(1),
Short: "Check out and install a dotfiles repository.",
Short: "Checkout and install a dotfiles repository from a Git URL",
Example: formatExamples(
example{
Description: "Check out and install a dotfiles repository without prompts",
Expand Down
2 changes: 1 addition & 1 deletion cli/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func features() *cobra.Command {
cmd := &cobra.Command{
Short: "List features",
Short: "List Enterprise features",
Use: "features",
Aliases: []string{"feature"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func list() *cobra.Command {
cmd := &cobra.Command{
Annotations: workspaceCommand,
Use: "list",
Short: "List all workspaces",
Short: "List workspaces",
Aliases: []string{"ls"},
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func login() *cobra.Command {
)
cmd := &cobra.Command{
Use: "login <url>",
Short: "Authenticate with a Coder deployment",
Short: "Authenticate with Coder deployment",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
rawURL := args[0]
Expand Down
2 changes: 1 addition & 1 deletion cli/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func logout() *cobra.Command {
cmd := &cobra.Command{
Use: "logout",
Short: "Remove the local authenticated session",
Short: "Unauthenticate your local session",
RunE: func(cmd *cobra.Command, args []string) error {
client, err := CreateClient(cmd)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func portForward() *cobra.Command {
)
cmd := &cobra.Command{
Use: "port-forward <workspace>",
Short: "Forward one or more ports from the local machine to the remote workspace",
Short: "Forward ports from machine to a workspace",
Aliases: []string{"tunnel"},
Args: cobra.ExactArgs(1),
Example: formatExamples(
Expand Down
2 changes: 1 addition & 1 deletion cli/publickey.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func publickey() *cobra.Command {
cmd := &cobra.Command{
Use: "publickey",
Aliases: []string{"pubkey"},
Short: "Output your public key for Git operations",
Short: "Output your Coder public key used for Git operations",
RunE: func(cmd *cobra.Command, args []string) error {
client, err := CreateClient(cmd)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/resetpassword.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func resetPassword() *cobra.Command {

root := &cobra.Command{
Use: "reset-password <username>",
Short: "Reset a user's password by directly updating the database",
Short: "Directly connect to the database to reset a user's password",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
username := args[0]
Expand Down
10 changes: 5 additions & 5 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,21 @@ func Root(subcommands []*cobra.Command) *cobra.Command {

cmd.SetUsageTemplate(usageTemplate())

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

return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion cli/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func schedules() *cobra.Command {
scheduleCmd := &cobra.Command{
Annotations: workspaceCommand,
Use: "schedule { show | start | stop | override } <workspace>",
Short: "Modify scheduled stop and start times for your workspace",
Short: "Schedule automated start and stop times for workspaces",
}

scheduleCmd.AddCommand(
Expand Down
Loading