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

Method artifactType

pkg/cmd/issue/artifact/create/create.go:86–96  ·  view source on GitHub ↗

artifactType returns the type of the source's artifact: link for a link, or for a document, the type from --type when typeFlag is set. Without it, a .html or .htm file is an HTML document, and any other document is generic.

(typeFlag string)

Source from the content-addressed store, hash-verified

84// or for a document, the type from --type when typeFlag is set. Without it, a
85// .html or .htm file is an HTML document, and any other document is generic.
86func (s source) artifactType(typeFlag string) string {
87 switch {
88 case s.isLink():
89 return client.TypeLink
90 case typeFlag != "":
91 return typeFlag
92 case s.kind == fromFile && shared.IsHTMLFile(s.arg):
93 return client.TypeEmbeddedHTML
94 }
95 return client.TypeGeneric
96}
97
98// NewCmdCreate creates the gh issue artifact create command.
99func NewCmdCreate(f *cmdutil.Factory, telemetry ghtelemetry.InvocationRecorder, runF func(*CreateOptions) error) *cobra.Command {

Callers 2

NewCmdCreateFunction · 0.80
readSourceFunction · 0.80

Calls 2

isLinkMethod · 0.95
IsHTMLFileFunction · 0.92

Tested by

no test coverage detected