- 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.
75 lines
2.3 KiB
Go
75 lines
2.3 KiB
Go
package keys
|
|
|
|
import "charm.land/bubbles/v2/key"
|
|
|
|
// screenHelp implements bubbles/help's Model.KeyMap with a fixed
|
|
// short/full binding set — one instance per screen, built fresh from the
|
|
// live *KeyMap so a `keys:` rebind or DisableWrites (read-only mode) is
|
|
// reflected without the screen needing to know about it.
|
|
type screenHelp struct {
|
|
short []key.Binding
|
|
full [][]key.Binding
|
|
}
|
|
|
|
func (h screenHelp) ShortHelp() []key.Binding { return h.short }
|
|
func (h screenHelp) FullHelp() [][]key.Binding { return h.full }
|
|
|
|
// BrowserHelp is the footer for the mounts/listing screens.
|
|
func (k *KeyMap) BrowserHelp() screenHelp {
|
|
return screenHelp{
|
|
short: []key.Binding{k.Up, k.Down, k.Enter, k.Back, k.Filter, k.New, k.Help, k.Quit},
|
|
full: [][]key.Binding{
|
|
{k.Up, k.Down, k.Top, k.Bottom, k.Enter, k.Back},
|
|
{k.Filter, k.Refresh, k.New, k.Profiles, k.Logout},
|
|
{k.Help, k.Quit, k.ForceQuit},
|
|
},
|
|
}
|
|
}
|
|
|
|
// SecretHelp is the footer for the secret detail screen.
|
|
func (k *KeyMap) SecretHelp() screenHelp {
|
|
return screenHelp{
|
|
short: []key.Binding{k.Up, k.Down, k.ToggleMask, k.CopyValue, k.Edit, k.Back, k.Help},
|
|
full: [][]key.Binding{
|
|
{k.Up, k.Down, k.Back, k.Versions},
|
|
{k.ToggleMask, k.ToggleMaskAll, k.CopyValue},
|
|
{k.Edit, k.Delete, k.Destroy},
|
|
{k.Help, k.Quit, k.ForceQuit},
|
|
},
|
|
}
|
|
}
|
|
|
|
// EditorHelp is the footer for the create/edit-secret screen.
|
|
func (k *KeyMap) EditorHelp() screenHelp {
|
|
return screenHelp{
|
|
short: []key.Binding{k.Save, k.AddField, k.DeleteField, k.Cancel},
|
|
full: [][]key.Binding{
|
|
{k.Save, k.AddField, k.DeleteField, k.Cancel},
|
|
},
|
|
}
|
|
}
|
|
|
|
// VersionsHelp is the footer for the KV v2 version-history screen.
|
|
func (k *KeyMap) VersionsHelp() screenHelp {
|
|
return screenHelp{
|
|
short: []key.Binding{k.Up, k.Down, k.Enter, k.Rollback, k.Undelete, k.Back},
|
|
full: [][]key.Binding{
|
|
{k.Up, k.Down, k.Enter, k.Back},
|
|
{k.Rollback, k.Undelete},
|
|
{k.Help, k.Quit, k.ForceQuit},
|
|
},
|
|
}
|
|
}
|
|
|
|
// AuthHelp is the footer for the auth-method picker phase (the form and
|
|
// waiting phases use their own fixed, non-rebindable hints since tab/
|
|
// enter/esc there are text-navigation, not KeyMap actions).
|
|
func (k *KeyMap) AuthHelp() screenHelp {
|
|
return screenHelp{
|
|
short: []key.Binding{k.Up, k.Down, k.Enter, k.Quit},
|
|
full: [][]key.Binding{
|
|
{k.Up, k.Down, k.Enter, k.Quit, k.ForceQuit},
|
|
},
|
|
}
|
|
}
|