Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run a program, returning an exit code.
Example ¶
package main
import (
"context"
"fmt"
"github.com/livebud/cli"
"github.com/livebud/di"
"github.com/livebud/program"
)
func main() {
provideCLI := func(in di.Injector) (cli.Parser, error) {
cli := cli.New("cli", "some cli")
cmd := cli.Command("say", "say hello")
cmd.Run(func(ctx context.Context) error {
fmt.Println("hello")
return nil
})
return cli, nil
}
in := di.New()
di.Provide[cli.Parser](in, provideCLI)
ctx := context.Background()
program.Parse(ctx, in, "say")
}
Output: hello
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.