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

Method UserAssets

internal/attachments/flags.go:44–52  ·  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

42// UserAssets validates the files named by the attachment flag, keeping them in
43// the order they were written. It returns nothing when the flag was not passed.
44func (f *Flag) UserAssets() ([]UserAsset, error) {
45 if !f.Changed() {
46 return nil, nil
47 }
48 if len(f.values) > maxAttachments {
49 return nil, fmt.Errorf("`--attach` accepts at most %d values per command", maxAttachments)
50 }
51 return userAssetsFromArgs(f.values)
52}
53
54func userAssetsFromArgs(args []string) ([]UserAsset, error) {
55 // --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