gui

package
v0.0.0-...-91fa891 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUESTS_VIEW = "requests"
	URL_VIEW      = "url"
	PARAMS_VIEW   = "params"
	RESPONSE_VIEW = "response"

	MENU_VIEW = "menu"
	EDIT_VIEW = "edit"
)
View Source
const UNKNOWN_VIEW_ERROR_MSG = "unknown view"

Variables

View Source
var VIEW_POSITIONS = map[string]viewPosition{
	REQUESTS_VIEW: {
		position{0.0, 0},
		position{0.0, 0},
		position{0.25, -1},
		position{1.0, -1},
	},
	URL_VIEW: {
		position{0.25, 0},
		position{0.0, 0},
		position{1.0, -1},
		position{0.1, -1},
	},
	PARAMS_VIEW: {
		position{0.25, 0},
		position{0.1, 0},
		position{0.6, -1},
		position{1.0, -1},
	},
	RESPONSE_VIEW: {
		position{0.6, 0},
		position{0.1, 0},
		position{1.0, -1},
		position{1.0, -1},
	},
	MENU_VIEW: {
		position{0.25, 0},
		position{0.25, 0},
		position{0.75, -1},
		position{0.75, -1},
	},
	EDIT_VIEW: {
		position{0.25, 0},
		position{0.25, 0},
		position{0.75, -1},
		position{0.75, -1},
	},
}

Functions

This section is empty.

Types

type Binding

type Binding struct {
	ViewName    string
	Handler     func(*gocui.Gui, *gocui.View) error
	Key         interface{}
	Modifier    gocui.Modifier
	Description string
}

Binding - a keybinding mapping a key and modifier to a handler. The keypress is only handled if the given view has focus, or handled globally if the view is ""

func (*Binding) GetKey

func (b *Binding) GetKey() string

GetKey is a function.

type Components

type Components struct {
	Requests *components.ListComponent[*commands.Request]

	Menu *components.ListComponent[*types.MenuItem]
}

type CreateEditOptions

type CreateEditOptions struct {
	Title string
	Value string
}

type CreateMenuOptions

type CreateMenuOptions struct {
	Title      string
	Items      []*types.MenuItem
	Index      int
	HideCancel bool
}

type Gui

type Gui struct {
	Config       *config.AppConfig
	Log          *logrus.Entry
	OSCommands   *commands.OSCommand
	HttpCommands *commands.HttpCommand
	Views        Views

	Components Components
	// contains filtered or unexported fields
}

Gui wraps the gocui Gui object which handles rendering and events

func NewGuiWrapper

func NewGuiWrapper(log *logrus.Entry, config *config.AppConfig, osCommands *commands.OSCommand, httpCommands *commands.HttpCommand) *Gui

func (*Gui) CurrentView

func (gui *Gui) CurrentView() *gocui.View

func (*Gui) DeleteRequest

func (gui *Gui) DeleteRequest(request *commands.Request) error

func (*Gui) Edit

func (gui *Gui) Edit(opts CreateEditOptions) error

func (*Gui) FocusY

func (gui *Gui) FocusY(selectedY int, lineCount int, v *gocui.View)

func (*Gui) GetInitialKeybindings

func (gui *Gui) GetInitialKeybindings() []*Binding

func (*Gui) GetRequestInfoView

func (gui *Gui) GetRequestInfoView() *gocui.View

func (*Gui) GetResponseInfoView

func (gui *Gui) GetResponseInfoView() *gocui.View

func (*Gui) GetUrlView

func (gui *Gui) GetUrlView() *gocui.View

func (*Gui) IsCurrentView

func (gui *Gui) IsCurrentView(view *gocui.View) bool

func (*Gui) Menu

func (gui *Gui) Menu(opts CreateMenuOptions) error

func (*Gui) RenderErrorString

func (gui *Gui) RenderErrorString(s string)

func (*Gui) Run

func (gui *Gui) Run() error

func (*Gui) SaveRequest

func (gui *Gui) SaveRequest(request *commands.Request) error

func (*Gui) SendRequest

func (gui *Gui) SendRequest(request *commands.Request) error

func (*Gui) SetColorScheme

func (gui *Gui) SetColorScheme() error

func (*Gui) Update

func (gui *Gui) Update(f func() error)

type Views

type Views struct {
	Requests     *gocui.View
	Url          *gocui.View
	RequestInfo  *gocui.View
	ResponseInfo *gocui.View

	Menu *gocui.View
	Edit *gocui.View
}

Directories

Path Synopsis
This is copy paste of jesseduffield lazydocker filteredlist
This is copy paste of jesseduffield lazydocker filteredlist

Jump to

Keyboard shortcuts

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