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