cmd/mbf: dump IR of artifact presets
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m49s
Test / ShareFS (push) Successful in 3m58s
Test / Hpkg (push) Successful in 4m37s
Test / Sandbox (race detector) (push) Successful in 5m0s
Test / Hakurei (race detector) (push) Successful in 6m11s
Test / Flake checks (push) Successful in 1m43s
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m49s
Test / ShareFS (push) Successful in 3m58s
Test / Hpkg (push) Successful in 4m37s
Test / Sandbox (race detector) (push) Successful in 5m0s
Test / Hakurei (race detector) (push) Successful in 6m11s
Test / Flake checks (push) Successful in 1m43s
This exposes IR outside test cases, useful for verifying correctness of alternative IR emitters. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -150,24 +150,50 @@ func main() {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
c.NewCommand(
|
{
|
||||||
"cure",
|
var (
|
||||||
"Cure the named artifact and show its path",
|
flagDump string
|
||||||
func(args []string) error {
|
)
|
||||||
if len(args) != 1 {
|
c.NewCommand(
|
||||||
return errors.New("cure requires 1 argument")
|
"cure",
|
||||||
}
|
"Cure the named artifact and show its path",
|
||||||
if p, ok := rosa.ResolveName(args[0]); !ok {
|
func(args []string) error {
|
||||||
return fmt.Errorf("unsupported artifact %q", args[0])
|
if len(args) != 1 {
|
||||||
} else {
|
return errors.New("cure requires 1 argument")
|
||||||
pathname, _, err := cache.Cure(rosa.Std.Load(p))
|
|
||||||
if err == nil {
|
|
||||||
log.Println(pathname)
|
|
||||||
}
|
}
|
||||||
return err
|
if p, ok := rosa.ResolveName(args[0]); !ok {
|
||||||
}
|
return fmt.Errorf("unsupported artifact %q", args[0])
|
||||||
},
|
} else if flagDump == "" {
|
||||||
)
|
pathname, _, err := cache.Cure(rosa.Std.Load(p))
|
||||||
|
if err == nil {
|
||||||
|
log.Println(pathname)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
f, err := os.OpenFile(
|
||||||
|
flagDump,
|
||||||
|
os.O_WRONLY|os.O_CREATE|os.O_EXCL,
|
||||||
|
0644,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = cache.EncodeAll(f, rosa.Std.Load(p)); err != nil {
|
||||||
|
_ = f.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return f.Close()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
).
|
||||||
|
Flag(
|
||||||
|
&flagDump,
|
||||||
|
"dump", command.StringFlag(""),
|
||||||
|
"Write IR to specified pathname and terminate",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
c.MustParse(os.Args[1:], func(err error) {
|
c.MustParse(os.Args[1:], func(err error) {
|
||||||
if cache != nil {
|
if cache != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user