(path string)
| 62 | } |
| 63 | |
| 64 | func (p *ManifestPathWithExistenceCheck) UnmarshalFlag(path string) error { |
| 65 | fileInfo, err := checkIfFileExists(path) |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | |
| 70 | if fileInfo.IsDir() { |
| 71 | locator := manifestparser.NewLocator() |
| 72 | pathToFile, existsInDirectory, err := locator.Path(path) |
| 73 | if err != nil { |
| 74 | return err |
| 75 | } |
| 76 | |
| 77 | if !existsInDirectory { |
| 78 | return &flags.Error{ |
| 79 | Type: flags.ErrRequired, |
| 80 | Message: fmt.Sprintf("The specified directory '%s' does not contain a file named 'manifest.yml'.", path), |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | *p = ManifestPathWithExistenceCheck(pathToFile) |
| 85 | } else { |
| 86 | *p = ManifestPathWithExistenceCheck(path) |
| 87 | } |
| 88 | |
| 89 | return nil |
| 90 | } |
| 91 | |
| 92 | type JSONOrFileWithValidation types.OptionalObject |
| 93 |
nothing calls this directly
no test coverage detected