Files
holos/internal/cli/compile.go
Jeff McCune 28a0a3625e compile: add basic structure of holos compile command
This command reads Component objects from a reader, exports a BuildPlan
from CUE, then marshals the result to the writer.

The purpose is to run concurrent instances of CUE to speed up build plan
generation prior to task execution.
2025-05-21 11:18:52 -07:00

28 lines
656 B
Go

package cli
import (
_ "embed"
"github.com/holos-run/holos/internal/cli/command"
"github.com/holos-run/holos/internal/compile"
"github.com/holos-run/holos/internal/errors"
"github.com/spf13/cobra"
)
//go:embed compile.txt
var compileLong string
// NewCompileCmd returns a new compile command.
func NewCompileCmd() *cobra.Command {
cmd := command.New("compile")
cmd.Short = "Compile Components (stdin) to BuildPlans (stdout) using CUE"
cmd.Long = compileLong
cmd.Args = cobra.NoArgs
cmd.RunE = func(cmd *cobra.Command, args []string) error {
c := compile.New()
ctx := cmd.Root().Context()
return errors.Wrap(c.Run(ctx))
}
return cmd
}