cli, entry, lang: Add an entry package for embeddable CLI's

This adds a new entry package that allows embedded programs to exist
inside of mgmt. This took a lot of refactoring to get the API right, but
I think it's incredibly elegant now. There is a chance we tweak things a
bit, but it's a good first start. All-in-one programs are coming soon!
This commit is contained in:
James Shubin
2024-03-04 22:09:44 -05:00
parent 9527d0dcbd
commit d52c90ede4
5 changed files with 339 additions and 0 deletions

View File

@@ -31,6 +31,12 @@ import (
"github.com/alexflint/go-arg"
)
func init() {
if _, err := arg.NewParser(arg.Config{}, &Args{}); err != nil { // sanity check
panic(errwrap.Wrapf(err, "invalid args cli struct"))
}
}
// CLI is the entry point for using mgmt normally from the CLI.
func CLI(ctx context.Context, data *cliUtil.Data) error {
// test for sanity