| Conditions | 5 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package writecmd |
||
| 10 | func Work(job *Job, append, originals bool, extensions []string, files *vars.Chunk, filesData *[]vars.File) ([]byte, error) { |
||
| 11 | filename, found := scan.Candidates(job.Filename(), files, extensions) |
||
| 12 | if !found { |
||
| 13 | return []byte{}, NoFileErr |
||
| 14 | } |
||
| 15 | |||
| 16 | if append { |
||
| 17 | if file, found := findScanned(filename, filesData); found { |
||
| 18 | job.MergePayload(file.Tags()) |
||
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | if !job.HasPayload() { |
||
| 23 | return []byte{}, SkipFileErr |
||
| 24 | } |
||
| 25 | |||
| 26 | payload := job.Payload() |
||
| 27 | result, err := etool.Write( |
||
| 28 | filename, |
||
| 29 | payload.Tags(), |
||
| 30 | payload.UseSeparator(), |
||
| 31 | originals, |
||
| 32 | ) |
||
| 33 | |||
| 34 | return result, err |
||
| 35 | } |
||
| 46 |