Skip to content

CLI runner for golang programs. Uses reflection to infer types

Notifications You must be signed in to change notification settings

baileywickham/runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runner

CLI runner for golang programs

Example Run

Usage

See example/ for example program

Support for argument parsing is extreamly limited. Working on that now...

Here is a default configuration:

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)
}

About

CLI runner for golang programs. Uses reflection to infer types

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages