Commit 3a1fc0ea authored by Aaron Jacobs's avatar Aaron Jacobs

Make op descriptions nicer.

parent f52a6099
...@@ -16,6 +16,7 @@ package fuseops ...@@ -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 { ...@@ -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
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment