make buildfile.reader.Execute() execute each instruction + log errors

This commit is contained in:
xdrm-brackets 2018-11-10 13:01:59 +01:00
parent b4a0f14907
commit 1705ff54d8
1 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"bufio"
"errors"
"fmt"
"git.xdrm.io/go/nix-amer/internal/clifmt"
"git.xdrm.io/go/nix-amer/internal/instruction"
"io"
"strings"
@ -80,5 +81,15 @@ func (r *Reader) Execute() error {
return fmt.Errorf("cannot upgrade | %s", err)
}
// 3. exec each instruction
for i, inst := range r.Content {
_, err := inst.Exec(*r.Context)
if err != nil {
fmt.Printf("%d | %s\n", i, err)
continue
}
fmt.Printf("%d | %s\n", i, clifmt.Color(32, "done"))
}
return nil
}