~emersion/drmdb

1c0233d9e637019e7406716586fe39d7f1f81bbb — Simon Ser 2 years ago 2d913cc
drmtree: print whether a prop is immutable/atomic
1 files changed, 15 insertions(+), 2 deletions(-)

M drmtree/drmtree.go
M drmtree/drmtree.go => drmtree/drmtree.go +15 -2
@@ 344,13 344,26 @@ func (m *PropertyMap) FormatTree(tf treefmt.Formatter) {

	for _, name := range names {
		prop := (*m)[name]
		// TODO: immutable, atomic

		s := fmt.Sprintf("%q: %v", name, prop.Type)

		var attrs []string
		if prop.Atomic {
			attrs = append(attrs, "atomic")
		}
		if prop.Immutable {
			attrs = append(attrs, "immutable")
		}
		if len(attrs) > 0 {
			s += " (" + strings.Join(attrs, ", ") +")"
		}

		// TODO: type-specific property data
		val := prop.Data
		if val == nil {
			val = prop.Value
		}
		tf.Printf("%q: %v = %v", name, prop.Type, val)
		tf.Printf("%v = %v", s, val)
	}
}