lsf: implement 'i' format for showing object ID - fixes #1476

This commit is contained in:
Nick Craig-Wood
2018-05-13 09:18:08 +01:00
parent 826975c341
commit 909c3a92d6
3 changed files with 17 additions and 0 deletions

View File

@@ -1420,6 +1420,16 @@ func (l *ListFormat) AddHash(ht hash.Type) {
})
}
// AddID adds file's ID to the output if known
func (l *ListFormat) AddID() {
l.AppendOutput(func() string {
if do, ok := l.entry.(fs.IDer); ok {
return do.ID()
}
return ""
})
}
// AppendOutput adds string generated by specific function to printed output
func (l *ListFormat) AppendOutput(functionToAppend func() string) {
if len(l.output) > 0 {