https://github.com/moqsien/goktrl
A powerful shell for process management. | goktrl 是一个用于本地进程管理的交互式shell。
https://github.com/moqsien/goktrl
go golang info interactive management process shell table terminal
Last synced: 4 months ago
JSON representation
A powerful shell for process management. | goktrl 是一个用于本地进程管理的交互式shell。
- Host: GitHub
- URL: https://github.com/moqsien/goktrl
- Owner: moqsien
- License: mit
- Created: 2022-09-19T14:51:23.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-28T13:45:06.000Z (over 2 years ago)
- Last Synced: 2024-04-18T02:58:05.560Z (about 2 years ago)
- Topics: go, golang, info, interactive, management, process, shell, table, terminal
- Language: Go
- Homepage:
- Size: 6.09 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
### Introduction to [goktrl](https://github.com/moqsien/goktrl)
------------------
[Zh_CN](https://github.com/moqsien/goktrl/blob/main/docs/ReadMeZh.md)
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
------------------
```shell
go get -u "github.com/moqsien/goktrl@v1.3.6"
```
- [More examples](https://github.com/moqsien/goktrl/tree/main/examples/ktrl)
- A simple One:
```go
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



### License
[MIT](https://github.com/moqsien/goktrl/blob/main/LICENSE)
### Thanks To
------------------
[dmicro](https://github.com/osgochina/dmicro)
[goframe](https://github.com/gogf/gf)
[gin](https://github.com/gin-gonic/gin)
[ishell](https://github.com/abiosoft/ishell)
[table](https://github.com/aquasecurity/table)