20 lines
312 B
Go
20 lines
312 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/alecthomas/kong"
|
|
)
|
|
|
|
func Execute(ctx context.Context) int {
|
|
var cli Root
|
|
pst := kong.Parse(&cli)
|
|
// Call the Run() method of the selected parsed command.
|
|
err := pst.Run(&Context{Context: ctx})
|
|
if err != nil {
|
|
pst.FatalIfErrorf(err)
|
|
return 1
|
|
}
|
|
return 0
|
|
}
|