Make op descriptions nicer.
parent
f52a6099c6
commit
3a1fc0ea46
|
@ -16,6 +16,7 @@ package fuseops
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/jacobsa/bazilfuse"
|
"github.com/jacobsa/bazilfuse"
|
||||||
|
@ -35,8 +36,19 @@ type commonOp struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func describeOpType(t reflect.Type) (desc string) {
|
func describeOpType(t reflect.Type) (desc string) {
|
||||||
// TODO(jacobsa): Make this nicer.
|
name := t.String()
|
||||||
|
|
||||||
|
// The usual case: a string that looks like "*fuseops.GetInodeAttributesOp".
|
||||||
|
const prefix = "*fuseops."
|
||||||
|
const suffix = "Op"
|
||||||
|
if strings.HasPrefix(name, prefix) && strings.HasSuffix(name, suffix) {
|
||||||
|
desc = name[len(prefix) : len(name)-len(suffix)]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, it's not clear what to do.
|
||||||
desc = t.String()
|
desc = t.String()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue