MCPcopy Create free account
hub / github.com/cli/cli / CheckType

Function CheckType

pkg/cmd/issue/artifact/shared/shared.go:282–288  ·  view source on GitHub ↗

CheckType refuses an artifact whose type this version of gh doesn't know. A new type can need handling gh doesn't have, so commands whose behavior depends on the type refuse it instead of guessing. Commands that work the same for every type, such as list, don't call it.

(a client.Artifact)

Source from the content-addressed store, hash-verified

280// depends on the type refuse it instead of guessing. Commands that work the
281// same for every type, such as list, don't call it.
282func CheckType(a client.Artifact) error {
283 switch a.Type {
284 case client.TypeGeneric, client.TypePlan, client.TypeLink, client.TypeEmbeddedHTML:
285 return nil
286 }
287 return fmt.Errorf("artifact %d has type %q, which this version of gh doesn't support; upgrade gh", a.Number, a.Type)
288}
289
290// SupportsAttachments reports whether an artifact of type artifactType can
291// take --attach files. Attachments go in Markdown, which only generic and plan

Callers 4

viewRunFunction · 0.92
selectVersionFunction · 0.92
editRunFunction · 0.92
TestCheckTypeFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestCheckTypeFunction · 0.68