package build import ( "fmt" "code.vulpine.solutions/sam/vlp/internal/packages" "code.vulpine.solutions/sam/vlp/internal/state" "github.com/urfave/cli/v2" ) var Command = &cli.Command{ Name: "build", Aliases: []string{"b"}, Usage: "Build a package from source", Args: true, ArgsUsage: "", Action: action, } func action(ctx *cli.Context) error { if ctx.NArg() < 1 { return cli.Exit("Not enough arguments", 1) } name := ctx.Args().Get(0) script, err := packages.LookupPackageFile(name) if err != nil { return err } s := state.New(name) err = s.Eval(script) if err != nil { return err } err = s.Build() if err != nil { return err } fmt.Println(s.Builder.Name, s.Builder.Dependencies) return nil }