You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO "unfiltered" or something for not applying Dockerfile filtering (once that's implemented)
435
+
},
436
+
Before: subcommandBeforeFactory("context"),
437
+
Action: func(c*cli.Context) error {
438
+
repos, err:=repos(false, c.Args()...)
439
+
iferr!=nil {
440
+
returnerr
441
+
}
442
+
iflen(repos) !=1 {
443
+
returnfmt.Errorf("'context' expects to act on exactly one architecture of one entry of one repo (got %d repos)", len(repos))
444
+
}
445
+
446
+
r, err:=fetch(repos[0])
447
+
iferr!=nil {
448
+
returnerr
449
+
}
450
+
451
+
// TODO technically something like "hello-world:latest" *could* be relaxed a little if it resolves via architecture to one and only one entry 🤔 (but that's a little hard to implement with the existing internal data structures -- see TODO at the top of "sort.go")
452
+
453
+
ifr.TagEntry==nil {
454
+
returnfmt.Errorf("'context' expects to act on exactly one architecture of one entry of one repo (no specific entry of %q selected)", r.RepoName)
455
+
}
456
+
iflen(r.TagEntries) !=1 {
457
+
returnfmt.Errorf("'context' expects to act on exactly one architecture of one entry of one repo (got %d entires)", len(r.TagEntries))
458
+
}
459
+
460
+
if!r.TagEntry.HasArchitecture(arch) {
461
+
returnfmt.Errorf("%q does not include architecture %q", path.Join(namespace, r.RepoName)+":"+r.TagEntry.Tags[0], arch)
462
+
}
463
+
464
+
ifc.Bool("sha256") {
465
+
sum, err:=r.ArchGitChecksum(arch, r.TagEntry)
466
+
iferr!=nil {
467
+
returnerr
468
+
}
469
+
fmt.Println(sum)
470
+
returnnil
471
+
} else {
472
+
ifxTerm.IsTerminal(int(os.Stdout.Fd())) {
473
+
returnfmt.Errorf("cowardly refusing to output a tar to a terminal")
Copy file name to clipboardExpand all lines: cmd/bashbrew/sort.go
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ import (
5
5
"pault.ag/go/topsort"
6
6
)
7
7
8
+
// TODO unify archFilter and applyConstraints handling by pre-filtering the full list of Repo objects such that all that remains are things we should process (thus removing all "if" statements throughout the various loops); re-doing the Architectures and Entries lists to only include ones we should process, etc
0 commit comments