Skip to content
/ goktrl Public

A powerful shell for process management. | goktrl 是一个用于本地进程管理的交互式shell。

License

Notifications You must be signed in to change notification settings

moqsien/goktrl

Repository files navigation

Introduction to goktrl


Zh_CN

goktrl is a powerful interactive shell designed to probe into your multi-processing go projects by using unix domain sockets.

Characteristics


  • interactive shell
  • nice hints for args and options
  • use struct tags for configuration of options
  • automatically parse and verify args and options
  • automatically render table for terminal if enabled
  • automatically handle and print data if enabled(including table data)
  • connect to your process using unix domain sockets
  • dispatching requests easily
  • very intuitive and flexible

Usage


go get -u "github.com/moqsien/goktrl@v1.3.6"
package main

import (
	"fmt"

	"github.com/moqsien/goktrl"
)

/*
  A very simple example by implementing goktrl.
  Even a hook for the shell is not required.
*/

func Handler(c *goktrl.Context) {
	fmt.Printf("$$ server: args = %v\n", c.Args) // args are automatically parsed and stored in c.Args
	Result := map[string]string{
		"hello": "info",
	}
	c.Send(Result)
}

func ShowInfo() *goktrl.Ktrl {
	kt := goktrl.NewKtrl()
	kt.AddKtrlCommand(&goktrl.KCommand{
		Name:            "info",          // name of your shell command
		Help:            "show info",     // help info for your shell command
		KtrlHandler:     Handler,         // view controller for server side
		Auto:            true,            // automatically show results or not
	})
	return kt
}

func main() {
	kt := ShowInfo()
	if len(os.Args) > 1 {
		kt.RunShell()
	} else {
		kt.RunCtrl()
	}
}
  • Some Exibitions shell-0 shell-1 shell-2

License

MIT

Thanks To


dmicro

goframe

gin

ishell

table

About

A powerful shell for process management. | goktrl 是一个用于本地进程管理的交互式shell。

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages