AddFile adds a single file to the files from list
(file string)
| 369 | |
| 370 | // AddFile adds a single file to the files from list |
| 371 | func (f *Filter) AddFile(file string) error { |
| 372 | f.initAddFile() |
| 373 | file = strings.Trim(file, "/") |
| 374 | f.files[file] = struct{}{} |
| 375 | // Put all the parent directories into f.dirs |
| 376 | for { |
| 377 | file = path.Dir(file) |
| 378 | if file == "." { |
| 379 | break |
| 380 | } |
| 381 | if _, found := f.dirs[file]; found { |
| 382 | break |
| 383 | } |
| 384 | f.dirs[file] = struct{}{} |
| 385 | } |
| 386 | return nil |
| 387 | } |
| 388 | |
| 389 | // Files returns all the files from the `--files-from` list |
| 390 | // |