screen

package
v0.0.0-...-31b4c3b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package screen containing of TUI screens.

Index

Constants

View Source
const (
	SecretTypeCredentials int32 = iota
	SecretTypeText
	SecretTypeBinary
	SecretTypeBankCard
)

Variables

This section is empty.

Functions

func DataCmd

func DataCmd(d models.Data) tea.Cmd

DataCmd func for converting data to tea cmd.

Types

type ActionResult

type ActionResult struct {
	Cmd     tea.Cmd
	Result  string
	Success bool
}

ActionResult type for transfer result of action.

type Form

type Form struct {
	// contains filtered or unexported fields
}

Form screen for form fields.

func NewForm

func NewForm(st *state.State,
	name string,
	modelBack tea.Model,
	modelSubmit tea.Model,
	ips []InputParam,
	callback func([]string) tea.Cmd,
) *Form

NewForm creates form with fields.

func (*Form) Fields

func (m *Form) Fields() tea.Msg

Fields returns form fields as tea.msg.

func (*Form) FieldsStr

func (m *Form) FieldsStr() []string

FieldsStr returns form ffields as string slice.

func (*Form) Init

func (m *Form) Init() tea.Cmd

Init TUI model.

func (*Form) Update

func (m *Form) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*Form) View

func (m *Form) View() string

View for TUI model.

type FormFields

type FormFields []string

type FormText

type FormText struct {
	// contains filtered or unexported fields
}

FormText struct for form with name and text.

func NewFormText

func NewFormText(st *state.State,
	name,
	placeholder string,
	modelBack tea.Model,
	modelSubmit tea.Model,
	callback func([]string) tea.Cmd,
) *FormText

NewFormText returns new form text.

func (*FormText) Fields

func (m *FormText) Fields() tea.Msg

Fields returns form fields as tea.Msg.

func (*FormText) FieldsStr

func (m *FormText) FieldsStr() []string

FieldsStr returns form fields as string slice.

func (*FormText) FocusInput

func (m *FormText) FocusInput() bool

FocusInput - is focus on secret name.

func (*FormText) FocusNext

func (m *FormText) FocusNext()

FocusNext - focus to next element.

func (*FormText) FocusSubmit

func (m *FormText) FocusSubmit() bool

FocusSubmit - is focus on submit button.

func (*FormText) FocusText

func (m *FormText) FocusText() bool

FocusText - is focus on secret text.

func (*FormText) Init

func (m *FormText) Init() tea.Cmd

Init TUI model.

func (*FormText) Update

func (m *FormText) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*FormText) View

func (m *FormText) View() string

View for TUI model.

type FormView

type FormView struct {
	// contains filtered or unexported fields
}

FormView - struct for readonly form.

func NewFormView

func NewFormView(st *state.State) *FormView

NewFormView returns new form view.

func (*FormView) Init

func (m *FormView) Init() tea.Cmd

Init TUI model.

func (*FormView) Update

func (m *FormView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*FormView) View

func (m *FormView) View() string

View for TUI model.

type FormViewComponent

type FormViewComponent struct {
	Name, Value string
}

FormViewComponent settings for input component.

type FormViewInit

type FormViewInit struct {
	Name       string
	ModelBack  tea.Model
	TextName   string
	Text       string
	Components []FormViewComponent
}

FormViewInit struct with initialization for screen FormView.

type InputParam

type InputParam struct {
	Placeholder string
	Password    bool
}

type Login

type Login struct {
	// contains filtered or unexported fields
}

Login struct for login form.

func NewLogin

func NewLogin(st *state.State) *Login

NewLogin returns new login form.

func (*Login) Init

func (m *Login) Init() tea.Cmd

Init TUI model.

func (*Login) Login

func (m *Login) Login() tea.Msg

Login login on server.

func (*Login) Update

func (m *Login) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*Login) View

func (m *Login) View() string

View for TUI model.

type Register

type Register struct {
	// contains filtered or unexported fields
}

Register struct for registration form.

func NewRegister

func NewRegister(st *state.State) *Register

NewRegister returns registration form.

func (*Register) Init

func (m *Register) Init() tea.Cmd

func (*Register) Register

func (m *Register) Register() tea.Msg

func (*Register) Update

func (m *Register) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Register) View

func (m *Register) View() string

View for TUI model.

type SecretAddText

type SecretAddText struct {
	// contains filtered or unexported fields
}

func NewSecretAddText

func NewSecretAddText(st *state.State) *SecretAddText

NewSecretAddText creates screen for input long text.

func (*SecretAddText) FocusName

func (m *SecretAddText) FocusName() bool

FocusName is name focused.

func (*SecretAddText) FocusNext

func (m *SecretAddText) FocusNext()

FocusNext - moves focus to next element.

func (*SecretAddText) FocusSubmit

func (m *SecretAddText) FocusSubmit() bool

FocusSubmit - is submit button focused.

func (*SecretAddText) FocusText

func (m *SecretAddText) FocusText() bool

FocusText is text focused.

func (*SecretAddText) Init

func (m *SecretAddText) Init() tea.Cmd

Init TUI model.

func (*SecretAddText) Update

func (m *SecretAddText) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*SecretAddText) View

func (m *SecretAddText) View() string

View for TUI model.

type SecretChoose

type SecretChoose struct {
	// contains filtered or unexported fields
}

func NewSecretChoose

func NewSecretChoose(st *state.State) *SecretChoose

func (*SecretChoose) Init

func (m *SecretChoose) Init() tea.Cmd

Init TUI model.

func (*SecretChoose) Update

func (m *SecretChoose) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*SecretChoose) View

func (m *SecretChoose) View() string

View for TUI model.

type SecretChooseInit

type SecretChooseInit struct {
	Back        tea.Model
	SecretTypes []tea.Model
}

type Secrets

type Secrets struct {
	// contains filtered or unexported fields
}

Secrets screen with secret list.

func NewSecrets

func NewSecrets(st *state.State, addInitCmd tea.Cmd) *Secrets

NewSecrets creates new secrets.

func (*Secrets) Add

func (m *Secrets) Add(d models.Data) tea.Cmd

Add new item.

func (*Secrets) Init

func (m *Secrets) Init() tea.Cmd

Init TUI model.

func (*Secrets) ItemView

func (m *Secrets) ItemView(secret *models.Secret) tea.Cmd

ItemView view item from secret list.

func (*Secrets) Reload

func (m *Secrets) Reload() tea.Msg

Reload reloads secret list.

func (*Secrets) Update

func (m *Secrets) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*Secrets) View

func (m *Secrets) View() string

View for TUI model.

type Welcome

type Welcome struct {
	// contains filtered or unexported fields
}

Welcome screen.

func NewWelcome

func NewWelcome(st *state.State, buildVersion, buildTime string) *Welcome

NewWelcome returns new welcome screen.

func (*Welcome) Init

func (m *Welcome) Init() tea.Cmd

Init TUI model.

func (*Welcome) Update

func (m *Welcome) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update TUI model.

func (*Welcome) View

func (m *Welcome) View() string

View for TUI model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL