gui

package
v0.0.0-...-c6350f3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyJSON = errors.New("empty json")
)
View Source
var NaviPageName = "navi_panel"
View Source
var RedColor = `[red::b]%s[white]: %s`

Functions

func NewRootTreeNode

func NewRootTreeNode(i interface{}) *tview.TreeNode

func UnMarshalJSON

func UnMarshalJSON(in io.Reader) (interface{}, error)

Types

type Gui

type Gui struct {
	Tree  *Tree
	Navi  *Navi
	App   *tview.Application
	Pages *tview.Pages
}

func New

func New() *Gui

func (*Gui) AddNode

func (g *Gui) AddNode()

func (*Gui) AddValue

func (g *Gui) AddValue()

func (*Gui) EditWithEditor

func (g *Gui) EditWithEditor()

func (*Gui) Form

func (g *Gui) Form(fieldLabel []string, doneLabel, title, pageName string,
	height int, doneFunc func(values map[string]string) error)

func (*Gui) Input

func (g *Gui) Input(text, label string, width int, doneFunc func(text string))

func (*Gui) LoadJSON

func (g *Gui) LoadJSON()

func (*Gui) MakeJSON

func (g *Gui) MakeJSON(node *tview.TreeNode) interface{}

func (*Gui) Message

func (g *Gui) Message(message, page string, doneFunc func())

func (*Gui) Modal

func (g *Gui) Modal(p tview.Primitive, width, height int) tview.Primitive

func (*Gui) NaviPanel

func (g *Gui) NaviPanel()

func (*Gui) Run

func (g *Gui) Run(i interface{}) error

func (*Gui) SaveJSON

func (g *Gui) SaveJSON()

func (*Gui) SaveJSONToFile

func (g *Gui) SaveJSONToFile(file string) error

func (*Gui) Search

func (g *Gui) Search()

type JSONType

type JSONType int
const (
	Root JSONType = iota + 1
	Object
	Array
	Key
	Value
)

func (JSONType) String

func (t JSONType) String() string
type Navi struct {
	*tview.TextView
}

func NewNavi

func NewNavi() *Navi
func (n *Navi) SetKeybindings(g *Gui)
func (n *Navi) UpdateView()

type Reference

type Reference struct {
	ID        string
	JSONType  JSONType
	ValueType ValueType
}

type Tree

type Tree struct {
	*tview.TreeView
	OriginRoot *tview.TreeNode
}

func NewTree

func NewTree() *Tree

func (*Tree) AddNode

func (t *Tree) AddNode(node interface{}) []*tview.TreeNode

func (*Tree) CollapseValues

func (t *Tree) CollapseValues(node *tview.TreeNode)

func (*Tree) NewNodeWithLiteral

func (t *Tree) NewNodeWithLiteral(i interface{}) *tview.TreeNode

func (*Tree) SetKeybindings

func (t *Tree) SetKeybindings(g *Gui)

func (*Tree) UpdateView

func (t *Tree) UpdateView(g *Gui, i interface{})

type ValueType

type ValueType int
const (
	Int ValueType = iota + 1
	String
	Float
	Boolean
	Null
)

func (ValueType) String

func (v ValueType) String() string

Jump to

Keyboard shortcuts

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