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.
()
| 61 | // UserAssets validates the files named by the attachment flag, keeping them in |
| 62 | // the order they were written. It returns nothing when the flag was not passed. |
| 63 | func (f *Flag) UserAssets() ([]UserAsset, error) { |
| 64 | if !f.Changed() { |
| 65 | return nil, nil |
| 66 | } |
| 67 | if len(f.values) > maxAttachments { |
| 68 | return nil, fmt.Errorf("`--attach` accepts at most %d values per command", maxAttachments) |
| 69 | } |
| 70 | return userAssetsFromArgs(f.values) |
| 71 | } |
| 72 | |
| 73 | func userAssetsFromArgs(args []string) ([]UserAsset, error) { |
| 74 | // --attach "" is a user error. |