ui

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// StatusView widget sets the response staus code
	StatusView = "status"
	// DelayView widget sets the response delay time
	DelayView = "delay"
	// HeaderView widget sets the response headers
	HeaderView = "headers"
	// BodyView widget sets the response body content
	BodyView = "body"
	// BodyFileView widget shows the file content to be set on the response body
	BodyFileView = "bodyfile"
	// RequestView widget displays the request
	RequestView = "request"
	// InfoView widget displays the bottom info bar
	InfoView = "info"
	// SaveView widget displays the saving location
	SaveView = "save"
	// ResponsesView widget displays the saved responses
	ResponsesView = "responses"
	// BindingsView widget displays binding help
	BindingsView = "bindings"
	// FileDialogView widget displays the popup to choose the response body file
	FileDialogView = "file-dialog"
)

Variables

View Source
var Bindings = &bindings{
	{gocui.KeyTab, "Tab", "Next Input", nil, onNextView},
	{0xFF, "Shift+Tab", "Previous Input", nil, nil},
	{gocui.KeyCtrlA, "Ctrl+a", "Update Response", nil, onUpdateResponse},
	{gocui.KeyCtrlR, "Ctrl+r", "Reset Request history", nil, onResetRequests},
	{gocui.KeyCtrlS, "Ctrl+s", "Save Response as", nil, onSaveResponseAs},
	{gocui.KeyCtrlF, "Ctrl+f", "Save Request as", nil, onSaveRequestAs},
	{gocui.KeyCtrlL, "Ctrl+l", "Toggle Responses list", nil, onToggleResponsesList},
	{gocui.KeyCtrlT, "Ctrl+t", "Toggle Response builder", nil, onToggleResponseBuilder},
	{gocui.KeyCtrlO, "Ctrl+o", "Open Body file...", nil, onOpenFile},
	{gocui.KeyCtrlB, "Ctrl+b", "Switch Body mode", nil, onSwitchBodyMode},
	{gocui.KeyCtrlW, "Ctrl+w", "Toggle line wrapping", nil, onTogglLineWrapping},
	{'q', "q", "Close Popup", []string{"bindings", "responses"}, onClosePopup},
	{gocui.KeyPgup, "PgUp", "Previous Request", nil, onPrevRequest},
	{gocui.KeyPgdn, "PgDown", "Next Request", nil, onNextRequest},
	{gocui.KeyCtrlC, "Ctrl+c", "Quit", nil, onQuit},
}

Bindings are the list of binded key combinations

Functions

This section is empty.

Types

type ActionFn

type ActionFn func(*gocui.Gui, *gocui.View) error

ActionFn is binded to a key combination

type Cursors

type Cursors map[string]struct {
	// contains filtered or unexported fields
}

Cursors stores the cursor position for a specific view this is used to restore mouse position when click is detected.

func NewCursors

func NewCursors() Cursors

NewCursors returns a new Cursor.

func (Cursors) Get

func (c Cursors) Get(view string) (int, int)

Get gets the cursor position.

func (Cursors) Restore

func (c Cursors) Restore(view *gocui.View) error

Restore restores the cursor position.

func (Cursors) Set

func (c Cursors) Set(view string, x, y int)

Set sets the cursor position.

type Split

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

Split simplifies the layout definition.

func NewSplit

func NewSplit(size int) *Split

NewSplit returns a new Split

func (*Split) Current

func (s *Split) Current() int

Current returns the current point in the set

func (*Split) Fixed

func (s *Split) Fixed(points ...int) *Split

Fixed defines a set of fixed or absolute points

func (*Split) Next

func (s *Split) Next() int

Next returns the next point in the set

func (*Split) Relative

func (s *Split) Relative(points ...int) *Split

Relative defines a set of relative points

type UI

type UI struct {
	AutoUpdate bool
	// contains filtered or unexported fields
}

UI represent the state of the ui.

func New

func New(resp *httplab.Response, configPath string) *UI

New returns a new UI with default values specified on the Response.

func (*UI) AddRequest

func (ui *UI) AddRequest(g *gocui.Gui, req *http.Request) error

AddRequest adds a new request to the UI.

func (*UI) Display

func (ui *UI) Display(g *gocui.Gui, view string, bytes []byte) error

Display displays arbitraty info into a given view.

func (*UI) Info

func (ui *UI) Info(g *gocui.Gui, format string, args ...interface{})

Info prints information on the InfoView.

func (*UI) Init

func (ui *UI) Init(g *gocui.Gui) (chan<- error, error)

Init initializes the UI.

func (*UI) Layout

func (ui *UI) Layout(g *gocui.Gui) error

Layout sets the layout

func (*UI) Response

func (ui *UI) Response() *httplab.Response

Response returns the current response setting.

Jump to

Keyboard shortcuts

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