ExportData implements the cmdutil exportable interface for a single entry.
(fields []string)
| 61 | |
| 62 | // ExportData implements the cmdutil exportable interface for a single entry. |
| 63 | func (e dirEntry) ExportData(fields []string) map[string]interface{} { |
| 64 | data := map[string]interface{}{} |
| 65 | for _, field := range fields { |
| 66 | switch field { |
| 67 | case "name": |
| 68 | data[field] = e.Name |
| 69 | case "path": |
| 70 | data[field] = e.Path |
| 71 | case "nameRaw": |
| 72 | data[field] = e.NameRaw |
| 73 | case "pathRaw": |
| 74 | data[field] = e.PathRaw |
| 75 | case "type": |
| 76 | data[field] = e.Type |
| 77 | case "gitType": |
| 78 | data[field] = e.GitType |
| 79 | case "mode": |
| 80 | data[field] = e.Mode |
| 81 | case "modeOctal": |
| 82 | data[field] = e.modeOctal() |
| 83 | case "gitSHA": |
| 84 | data[field] = e.GitSHA |
| 85 | case "size": |
| 86 | data[field] = e.Size |
| 87 | case "submodule": |
| 88 | if e.Submodule == nil { |
| 89 | data[field] = nil |
| 90 | } else { |
| 91 | data[field] = map[string]interface{}{ |
| 92 | "gitUrl": e.Submodule.GitURL, |
| 93 | "branch": e.Submodule.Branch, |
| 94 | "subprojectCommitOid": e.Submodule.SubprojectCommitOid, |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | return data |
| 100 | } |
| 101 | |
| 102 | // ExportData implements the cmdutil exportable interface for the directory. |
| 103 | // |