(path string)
| 128 | } |
| 129 | |
| 130 | func (p *PathWithExistenceCheckOrURL) UnmarshalFlag(path string) error { |
| 131 | if !strings.HasPrefix(path, "http://") && !strings.HasPrefix(path, "https://") { |
| 132 | _, err := os.Stat(path) |
| 133 | if err != nil { |
| 134 | if os.IsNotExist(err) { |
| 135 | return &flags.Error{ |
| 136 | Type: flags.ErrRequired, |
| 137 | Message: fmt.Sprintf("The specified path '%s' does not exist.", path), |
| 138 | } |
| 139 | } |
| 140 | return err |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | *p = PathWithExistenceCheckOrURL(path) |
| 145 | return nil |
| 146 | } |
| 147 | |
| 148 | type PathWithAt string |
| 149 |
nothing calls this directly
no test coverage detected