https://github.com/baileywickham/runner
CLI runner for golang programs. Uses reflection to infer types
https://github.com/baileywickham/runner
cli-runner go golang shell
Last synced: 5 months ago
JSON representation
CLI runner for golang programs. Uses reflection to infer types
- Host: GitHub
- URL: https://github.com/baileywickham/runner
- Owner: baileywickham
- Created: 2020-02-10T17:36:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-05T17:00:45.000Z (over 5 years ago)
- Last Synced: 2023-03-09T03:25:53.902Z (over 3 years ago)
- Topics: cli-runner, go, golang, shell
- Language: Go
- Homepage:
- Size: 178 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# runner
CLI runner for golang programs

## Usage
See `example/` for example program
Support for argument parsing is extreamly limited. Working on that now...
Here is a default configuration:
```golang
import r "github.com/baileywickham/runner"
func main() {
shell := r.NewShell()
c1 := r.Command{
Cmd: "echo",
Callback: echo,
Helptext: "print a string to stdout"}
c2 := r.Command{
Cmd: "addTen",
Callback: addTen,
Helptext: "takes and int and adds 10"}
shell.Add_command(c1, c2) // Add command uses variadic arguments
shell.Flags() // Parse from cli flags instead of runner
shell.Start() // Parse from runner, a shell like interface
}
func echo(s string) {
println(s)
}
func addTen(i int) {
println(i + 10)
}
```