e154 / console

golang embedded console

Home Page:http://e154.ru/blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#go console

golang console for embedded code

init

init as singleton

c_ptr := console.GetPtr()

use

set output handler

type someHandler struct {}

func (p *someHandler) Output(text []byte) {
    fmt.Println(string(text))
}

c_ptr.Output(h)

variables

assignment of variables to be able to access them

c_ptr.AddBool("bb", &bb)
c_ptr.AddFloat("ff", &ff)
c_ptr.AddInt("ii", &ii)
c_ptr.AddString("ss", &ss)

update varibles from code

c_ptr.Exec("set ii 22")

functions

function assignment:

t := &testFunc{}
c_ptr.AddCommand("test", t.ShareMethod)

exec function with args

c_ptr.Exec("test")
c_ptr.Exec("test true")

local help

default commands:

c_ptr.Exec("ls")
ls
variables:
bb,ff,ii,ss,
console commands:
ls - prints all variables and commands
get - get value of variables
set - sets value of variable
help - this help

created for http://e154.ru

About

golang embedded console

http://e154.ru/blog

License:GNU General Public License v3.0


Languages

Language:Go 100.0%