- Added internal/vault/client.go for creating a Vault client with configuration settings. - Introduced internal/vault/errors.go to classify Vault API errors for better UI handling. - Created internal/vault/kv.go to manage KV secrets, including listing, reading, writing, and deleting operations. - Implemented internal/vault/mounts.go to list and describe secret engine mounts. - Developed internal/vault/service.go to provide a unified entry point for Vault operations. - Added internal/vault/kv_test.go for comprehensive testing of KV operations. - Introduced internal/ui/toast.go for transient notifications in the UI. - Added renovate.json for dependency management and updates.
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package ui
|
|
|
|
import "charm.land/bubbles/v2/textinput"
|
|
|
|
// textInput is a local alias purely to keep the many field declarations in
|
|
// model.go from repeating the full package-qualified name.
|
|
type textInput = textinput.Model
|
|
|
|
// newTextInput is a method (not a free function) so every input picks up
|
|
// the current theme's colors via styles.TextInputStyles — otherwise inputs
|
|
// would render in bubbles' hard-coded default palette regardless of the
|
|
// user's theme/appearance settings.
|
|
func (m *Model) newTextInput(f fieldSpec) textInput {
|
|
ti := textinput.New()
|
|
ti.Placeholder = f.label
|
|
ti.SetStyles(m.styles.TextInputStyles())
|
|
if f.secret {
|
|
ti.EchoMode = textinput.EchoPassword
|
|
ti.EchoCharacter = '•'
|
|
}
|
|
ti.SetValue(f.value)
|
|
return ti
|
|
}
|
|
|
|
func (m *Model) textInputWithValue(label, val string) textInput {
|
|
return m.newTextInput(fieldSpec{label: label, value: val})
|
|
}
|
|
|
|
// fieldSpec is the minimal shape newTextInput needs; kept separate from
|
|
// auth.Field so this file has no dependency on the auth package.
|
|
type fieldSpec struct {
|
|
label string
|
|
secret bool
|
|
value string
|
|
}
|