ui

package
v0.0.0-...-01c0eb4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HttpuMode is always initially set to default.
	HttpuMode       = DefaultMode
	RequestView     *gocui.View
	ResponseView    *gocui.View
	CmdBarView      *gocui.View
	StatusCodeView  *gocui.View
	RequestTimeView *gocui.View
)
View Source
var Commands map[string]Command = map[string]Command{
	"clear":         ClearCommand{},
	"echo":          EchoCommand{},
	"list-commands": ListCommandsCommand{},
	"stash":         StashCommand{},
	"welcome":       WelcomeCommand{},
	"!":             ShellCommand{},
	"list-env":      ListEnvCommand{},
	"set-env":       SetEnvCommand{},
}

Commands is a map of all available commands to be used while in command mode.

Functions

This section is empty.

Types

type ClearCommand

type ClearCommand struct {
}

ClearCommand represents the command that will clear all contents from the request view screen.

Usage: clear

func (ClearCommand) Execute

func (cc ClearCommand) Execute(g *gocui.Gui, cmd string, args []string) error

Execute will clear the contents of the request view screen.

type Command

type Command interface {
	Execute(g *gocui.Gui, cmd string, args []string) error
}

Command requires each member to have an Execute func to allow each and any command to be executable while in command mode.

type EchoCommand

type EchoCommand struct {
}

EchoCommand represents the command that echos text out into the request view screen.

Usage: echo Hello, World!

func (EchoCommand) Execute

func (ec EchoCommand) Execute(g *gocui.Gui, cmd string, args []string) error

Execute will print each echo argument to the request view screen.

type ListCommandsCommand

type ListCommandsCommand struct {
}

ListCommandsCommand represents the command that will list all available commands that can be ran while in command mode.

Usage: list-commands

func (ListCommandsCommand) Execute

func (lcc ListCommandsCommand) Execute(g *gocui.Gui, cmd string, args []string) error

Execute will list all available commands, in the request view screen.

type ListEnvCommand

type ListEnvCommand struct {
}

func (ListEnvCommand) Execute

func (lec ListEnvCommand) Execute(g *gocui.Gui, cmd string, args []string) error

type Mode

type Mode int

Mode is the mode of the command bar, it being either in default mode, or toggled into command mode, in which additional commands within httpu can be used.

Default is always set to defaultMode, in which commands are not used.

const (
	DefaultMode Mode = iota
	CommandMode
)

func (*Mode) Toggle

func (m *Mode) Toggle()

Toggle changes the mode from either default to command or the other way around.

type SetEnvCommand

type SetEnvCommand struct {
}

func (SetEnvCommand) Execute

func (sec SetEnvCommand) Execute(g *gocui.Gui, cmd string, args []string) error

type ShellCommand

type ShellCommand struct {
}

func (ShellCommand) Execute

func (sc ShellCommand) Execute(g *gocui.Gui, cmd string, args []string) error

type StashCommand

type StashCommand struct {
}

func (StashCommand) Execute

func (sc StashCommand) Execute(g *gocui.Gui, cmd string, args []string) error

type Ui

type Ui struct {
	Gui *gocui.Gui
}

Ui is a wrapper for the gocui.Gui which is created and started at in main.

func New

func New() Ui

New returns a new instance of UI with a pre-configured layout.

func (Ui) Exit

func (u Ui) Exit() error

func (Ui) Start

func (u Ui) Start()

Start starts the main loop for the UI

type UiSpec

type UiSpec struct {
	RequestViewSpec     ViewSpec
	ResponseViewSpec    ViewSpec
	CmdBarViewSpec      ViewSpec
	StatusCodeViewSpec  ViewSpec
	RequestTimeViewSpec ViewSpec
	// contains filtered or unexported fields
}

UiSpec represents the default dimensions needed to create a user interface that matches the builtin termnial user interface. Other Go packages / programs can use these dimensions / settings to get a similar look to the default.

func NewUiSpec

func NewUiSpec(maxX, maxY int) UiSpec

type ViewSpec

type ViewSpec struct {
	Wrap  bool
	Title string
	// contains filtered or unexported fields
}

func (ViewSpec) Dimensions

func (vs ViewSpec) Dimensions() []int

type WelcomeCommand

type WelcomeCommand struct {
}

func (WelcomeCommand) Execute

func (wc WelcomeCommand) Execute(g *gocui.Gui, cmd string, args []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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