Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
hirenko-v authored Sep 20, 2024
1 parent 32e16a7 commit 5b08d6c
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions cmd/msg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,6 @@ func showBothSelects(state map[string]string) executor.ExecuteOutput {
}

var initialOption *api.OptionItem
if val, exists := state[option.Flags[0]]; exists {
initialOption = &api.OptionItem{
Name: val,
Value: val,
}
} else {
// Clear the option if the key does not exist
initialOption = &api.OptionItem{
Name: "", // Clear the field
Value: "", // Clear the field
}
}

// Use the flag as a key to track dropdown selections
sections[0].Selects.Items = append(sections[0].Selects.Items, api.Select{
Expand All @@ -263,7 +251,11 @@ func showBothSelects(state map[string]string) executor.ExecuteOutput {
Options: dropdownOptions,
},
},
InitialOption: initialOption,
InitialOption: func() *api.OptionItem {
if val, exists := state[option.Flags[0]]; exists && val != "" {
return &api.OptionItem{Name: val, Value: val}
}
return nil
})
}

Expand Down

0 comments on commit 5b08d6c

Please sign in to comment.