Skip to content

Commit 9f7db0a

Browse files
authored
Drop unused Default field from cmdio.PromptOptions (#5229)
## Summary - Remove the `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 (see PR #3252). Follow-up to #5177, which removed the now-orphaned `AllowEdit` companion field. - Drop the corresponding `--default` flag from `databricks selftest tui prompt`, which only existed to exercise the field. This pull request and its description were written by Isaac.
1 parent dc81fe9 commit 9f7db0a

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

cmd/auth/login.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ func promptForProfile(ctx context.Context, defaultValue string) (string, error)
3636
Label: "Databricks profile name [" + defaultValue + "]",
3737
})
3838
if result == "" {
39-
// Manually return the default value. We could use the prompt.Default
40-
// field, but be inconsistent with other prompts in the CLI.
4139
return defaultValue, err
4240
}
4341
return result, err

cmd/selftest/tui/prompt.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ import (
1111

1212
func newPromptCmd() *cobra.Command {
1313
var (
14-
defaultVal string
15-
mask bool
16-
validate bool
14+
mask bool
15+
validate bool
1716
)
1817
cmd := &cobra.Command{
1918
Use: "prompt",
2019
Short: "cmdio.RunPrompt (single-line text input)",
2120
RunE: func(cmd *cobra.Command, args []string) error {
2221
ctx := cmd.Context()
2322
opts := cmdio.PromptOptions{
24-
Label: "Enter a value",
25-
Default: defaultVal,
23+
Label: "Enter a value",
2624
}
2725
if mask {
2826
opts.Mask = '*'
@@ -47,7 +45,6 @@ func newPromptCmd() *cobra.Command {
4745
return nil
4846
},
4947
}
50-
cmd.Flags().StringVar(&defaultVal, "default", "", "pre-fill the input with this value")
5148
cmd.Flags().BoolVar(&mask, "mask", false, "echo input as '*'")
5249
cmd.Flags().BoolVar(&validate, "validate", false, "require '://' in input")
5350
return cmd

libs/cmdio/prompt.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ type PromptOptions struct {
1111
// Label is shown before the input field. Required.
1212
Label string
1313

14-
// Default is the value pre-filled in the input field.
15-
Default string
16-
1714
// Mask, when non-zero, replaces typed characters with the given rune
1815
// (use '*' for password-style input).
1916
Mask rune
@@ -31,7 +28,6 @@ func RunPrompt(ctx context.Context, opts PromptOptions) (string, error) {
3128
c := fromContext(ctx)
3229
p := promptui.Prompt{
3330
Label: opts.Label,
34-
Default: opts.Default,
3531
Mask: opts.Mask,
3632
HideEntered: opts.HideEntered,
3733
Validate: opts.Validate,

0 commit comments

Comments
 (0)