entry, lang: core: embedded: provisioner: Allow more than one entry

This changes the entry API slightly to allow for more than one entry
registered, which makes building, testing and user tooling easier.
This commit is contained in:
James Shubin
2024-04-16 14:10:20 -04:00
parent bc4b5d96b0
commit 68ee163eb1
4 changed files with 35 additions and 25 deletions

View File

@@ -91,8 +91,12 @@ func main() {
Args: os.Args,
}
name := ""
if len(data.Args) > 1 {
name = data.Args[1]
}
// is there an alternate entry point for the cli?
if cli, err := entry.Lookup(); err == nil && len(data.Args) > 1 && cli.Name() == data.Args[1] {
if cli, err := entry.Lookup(name); err == nil && cli.Name() == name {
data.Args = data.Args[1:] // pop off "argv[0]"
if err := cli.CLI(context.Background(), data); err != nil {
fmt.Println(err)