package main import ( "fmt" "git.xdrm.io/go/nix-amer/internal/buildfile" "git.xdrm.io/go/nix-amer/internal/clifmt" "os" ) func main() { // Manage arguments ctx, bf, dryRun, err := GetArgs() if err != nil { fmt.Printf("%s\n", err) return } // 1. get buildfile reader bfreader, err := os.Open(bf) if err != nil { fmt.Printf("cannot open buildfile | %s\n", err) return } defer bfreader.Close() // 2. parse buildfile instructions, err := buildfile.NewReader(ctx, bfreader) if err != nil { fmt.Printf("%s%s\n", bf, err) return } clifmt.Align("build file") fmt.Printf("%s\n", clifmt.Color(32, "valid")) // stop here if dry run if dryRun { return } // 3. Execute clifmt.Align("execution") fmt.Printf("start\n") err = instructions.Execute() if err != nil { fmt.Printf("%s\n", clifmt.Warn(err.Error())) return } clifmt.Align("execution") fmt.Printf("%s\n", clifmt.Color(32, "finished")) }