utils

package
v0.0.0-...-2bde531 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackColorName     = "#2B2B2B"
	BackBlueColorName = "#214283"
	BackGrayColorName = "#424445"
	BlueColorName     = "dodgerblue"
	GreenColorName    = "#629755"
)

Represents App color list

View Source
const (
	TreePrmtTitle  = "Requests"
	GitHubTViewURL = "https://godoc.org/github.com/rivo/tview"
	Title          = "GTTP"
	Subtitle       = Title + " - Go HTTP Client for Terminal UIs"
	TitleShortcuts = "Press [" + BlueColorName + "::ub]Escape[white::-] or Ctrl+[" + BlueColorName + "::ub]Q[white::-] to exit"
	GitHubLink     = "~//github.com/joakim-ribier/gttp"
)

Represents App global information

View Source
const (
	JShortcut = "Ctrl+[" + BlueColorName + "::ub]J[white::-]"
	EShortcut = "Ctrl+[" + BlueColorName + "::ub]E[white::-]"

	ExecuteShortcut   = EShortcut + " Execute"
	SelectAPIShortcut = JShortcut + " Select API"
	SettingsShortcut  = "Ctrl+[" + BlueColorName + "::ub]O[white::-] Settings"

	ShortcutD  = "Ctrl+[" + BlueColorName + "::ub]W[white::-] Response View"
	ShortcutF  = "Ctrl+[" + BlueColorName + "::ub]F[white::-] Make Request"
	ShortcutH  = "Ctrl+[" + BlueColorName + "::ub]H[white::-] Expert Mode"
	ShortcutQ  = "Ctrl+[" + BlueColorName + "::ub]Q[white::-] Exit"
	ShortcutR  = "Ctrl+[" + BlueColorName + "::ub]R[white::-] Request Header View"
	ShortcutDC = "Ctrl+[" + BlueColorName + "::ub]C[white::-] Copy Response"
	ShortcutDA = "Ctrl+[" + BlueColorName + "::ub]A[white::-] Copy All (log)"

	ShortcutHSubMenu        = ShortcutH + " >> Ctrl+[" + BlueColorName + "::ub]Down[white::-] Left Menu >> Select Letter (or press down/up)"
	SettingsShortcutSubMenu = SettingsShortcut + " >> Ctrl+[" + BlueColorName + "::ub]Down[white::-] Left Menu >> Select Letter (or press down/up)"
	ShortcutSRSubMenu       = " Save Request >> Ctrl+[" + BlueColorName + "::ub]Down[white::-] Left Menu >> Select Letter (or press down/up)"

	ShortcutPressEscape = "Press Escape"
	ShortcutSeparator   = " | "
)

Represents App shortcuts list

Variables

View Source
var (
	BackColor     = tcell.GetColor(BackColorName)
	BackBlueColor = tcell.GetColor(BackBlueColorName)
	BackGrayColor = tcell.GetColor(BackGrayColorName)
)

Represents data shortcuts to display to the user

View Source
var (
	MethodValues      = core.StringSlice{"GET", "POST", "PUT"}
	ContentTypeValues = core.StringSlice{
		"application/javascript",
		"application/json",
		"application/x-www-form-urlencoded",
		"application/xml",
		"application/zip",
		"application/pdf",
		"application/sql",
		"application/graphql",
		"application/ld+json",
		"application/msword",
		"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
		"application/vnd.ms-excel",
		"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
		"application/vnd.ms-powerpoint",
		"application/vnd.openxmlformats-officedocument.presentationml.presentation",
		"application/vnd.oasis.opendocument.text",
		"audio/mpeg",
		"audio/ogg",
		"multipart/form-data",
		"text/css",
		"text/html",
		"text/xml",
		"text/csv",
		"text/plain",
		"image/png",
		"image/jpeg",
		"image/gif",
	}
)

Represents data to make a new request

Functions

func AddInputFieldEventForm

func AddInputFieldEventForm(form *tview.Form, itemLabel string)

AddInputFieldEventForm add generic event to inputfield

func FormatLog

func FormatLog(message string, mode string) string

FormatLog formats the message to display

func GetDropDownFieldForm

func GetDropDownFieldForm(form *tview.Form, itemLabel string) *tview.DropDown

GetDropDownFieldForm get a dropdown field by label from the form

func GetInputFieldForm

func GetInputFieldForm(form *tview.Form, itemLabel string) *tview.InputField

GetInputFieldForm get an inputfield field by label from the form

func MakeSeparator

func MakeSeparator(color tcell.Color) *tview.Box

MakeSeparator create a simple tview.NewBox

func MakeTitlePrmt

func MakeTitlePrmt(title string) *tview.Flex

MakeTitlePrmt builds a title widget

func ReadFile

func ReadFile(filename string, logger func(message string, mode string)) []byte

ReadFile reads the file @filename and return the content. If ioutil.ReadFile return an error, method logs and returns an empty cotent ([]byte).

func ReadFromClipboard

func ReadFromClipboard() (string, error)

ReadFromClipboard reads data from the clipboard

func WriteToClipboard

func WriteToClipboard(data string, logger func(message string, event string))

WriteToClipboard writes data to the clipboard (Ctrl+C for example)

Types

This section is empty.

Jump to

Keyboard shortcuts

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