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

Method UserAssets

internal/attachments/flags.go:50–58  ·  view source on GitHub ↗

UserAssets validates the files named by the attachment flag, keeping them in the order they were written. It returns nothing when the flag was not passed.

()

Source from the content-addressed store, hash-verified

48// UserAssets validates the files named by the attachment flag, keeping them in
49// the order they were written. It returns nothing when the flag was not passed.
50func (f *Flag) UserAssets() ([]UserAsset, error) {
51 if !f.Changed() {
52 return nil, nil
53 }
54 if len(f.values) > maxAttachments {
55 return nil, fmt.Errorf("`--attach` accepts at most %d values per command", maxAttachments)
56 }
57 return userAssetsFromArgs(f.values)
58}
59
60func userAssetsFromArgs(args []string) ([]UserAsset, error) {
61 // --attach "" is a user error.

Callers 8

NewCmdCreateFunction · 0.80
NewCmdEditFunction · 0.80
CommentablePreRunFunction · 0.80
NewCmdCreateFunction · 0.80
NewCmdEditFunction · 0.80
NewTestAssetsFunction · 0.80
assetsFromArgsFunction · 0.80
TestFlagUserAssetsFunction · 0.80

Calls 3

ChangedMethod · 0.95
userAssetsFromArgsFunction · 0.85
ErrorfMethod · 0.65

Tested by 2

assetsFromArgsFunction · 0.64
TestFlagUserAssetsFunction · 0.64