From 9e7f8ffbfce6aa8f08bd58094284690bca6767e9 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 11 May 2026 11:27:32 +0200 Subject: [PATCH] Drop unused Default field from cmdio.PromptOptions No production caller sets it. databricks auth login renders the default in the label and substitutes it manually on empty input (PR #3252), and no other prompt uses it. Also drop the --default flag from selftest tui prompt, which only existed to exercise the field. Co-authored-by: Isaac --- cmd/auth/login.go | 2 -- cmd/selftest/tui/prompt.go | 9 +++------ libs/cmdio/prompt.go | 4 ---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/cmd/auth/login.go b/cmd/auth/login.go index 03cd9859f8..aedaab06cf 100644 --- a/cmd/auth/login.go +++ b/cmd/auth/login.go @@ -36,8 +36,6 @@ func promptForProfile(ctx context.Context, defaultValue string) (string, error) Label: "Databricks profile name [" + defaultValue + "]", }) if result == "" { - // Manually return the default value. We could use the prompt.Default - // field, but be inconsistent with other prompts in the CLI. return defaultValue, err } return result, err diff --git a/cmd/selftest/tui/prompt.go b/cmd/selftest/tui/prompt.go index ed663116d0..9c5be5319a 100644 --- a/cmd/selftest/tui/prompt.go +++ b/cmd/selftest/tui/prompt.go @@ -11,9 +11,8 @@ import ( func newPromptCmd() *cobra.Command { var ( - defaultVal string - mask bool - validate bool + mask bool + validate bool ) cmd := &cobra.Command{ Use: "prompt", @@ -21,8 +20,7 @@ func newPromptCmd() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() opts := cmdio.PromptOptions{ - Label: "Enter a value", - Default: defaultVal, + Label: "Enter a value", } if mask { opts.Mask = '*' @@ -47,7 +45,6 @@ func newPromptCmd() *cobra.Command { return nil }, } - cmd.Flags().StringVar(&defaultVal, "default", "", "pre-fill the input with this value") cmd.Flags().BoolVar(&mask, "mask", false, "echo input as '*'") cmd.Flags().BoolVar(&validate, "validate", false, "require '://' in input") return cmd diff --git a/libs/cmdio/prompt.go b/libs/cmdio/prompt.go index 760a99af4a..41b42b62e7 100644 --- a/libs/cmdio/prompt.go +++ b/libs/cmdio/prompt.go @@ -11,9 +11,6 @@ type PromptOptions struct { // Label is shown before the input field. Required. Label string - // Default is the value pre-filled in the input field. - Default string - // Mask, when non-zero, replaces typed characters with the given rune // (use '*' for password-style input). Mask rune @@ -31,7 +28,6 @@ func RunPrompt(ctx context.Context, opts PromptOptions) (string, error) { c := fromContext(ctx) p := promptui.Prompt{ Label: opts.Label, - Default: opts.Default, Mask: opts.Mask, HideEntered: opts.HideEntered, Validate: opts.Validate,