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.
()
| 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. |
| 44 | func (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 | |
| 54 | func userAssetsFromArgs(args []string) ([]UserAsset, error) { |
| 55 | // --attach "" is a user error. |