mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
pkg: Move camel_to_dashed from util/ to strutil/.
This commit is contained in:
parent
ee62608e88
commit
eae14f91b9
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/elves/elvish/pkg/eval/vals"
|
||||
"github.com/elves/elvish/pkg/parse"
|
||||
"github.com/elves/elvish/pkg/util"
|
||||
"github.com/elves/elvish/pkg/strutil"
|
||||
)
|
||||
|
||||
// RawOptions is the type of an argument a Go-native function can take to
|
||||
|
@ -36,7 +36,7 @@ func scanOptions(rawOpts RawOptions, ptr interface{}) error {
|
|||
f := struc.Type().Field(i)
|
||||
optName := f.Tag.Get("name")
|
||||
if optName == "" {
|
||||
optName = util.CamelToDashed(f.Name)
|
||||
optName = strutil.CamelToDashed(f.Name)
|
||||
}
|
||||
fieldIdxForOpt[optName] = i
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/elves/elvish/pkg/util"
|
||||
"github.com/elves/elvish/pkg/strutil"
|
||||
)
|
||||
|
||||
// StructMap may be implemented by a struct to mark the struct as a "struct
|
||||
|
@ -70,7 +70,7 @@ func makeStructMapInfo(t reflect.Type) structMapInfo {
|
|||
for i := 0; i < n; i++ {
|
||||
field := t.Field(i)
|
||||
if field.PkgPath == "" && !field.Anonymous {
|
||||
fieldNames[i] = util.CamelToDashed(field.Name)
|
||||
fieldNames[i] = strutil.CamelToDashed(field.Name)
|
||||
filledFields++
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ func makeStructMapInfo(t reflect.Type) structMapInfo {
|
|||
for i := 0; i < m; i++ {
|
||||
method := t.Method(i)
|
||||
if method.PkgPath == "" && method.Type.NumIn() == 1 && method.Type.NumOut() == 1 {
|
||||
fieldNames[i+n] = util.CamelToDashed(method.Name)
|
||||
fieldNames[i+n] = strutil.CamelToDashed(method.Name)
|
||||
filledFields++
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package util
|
||||
package strutil
|
||||
|
||||
import (
|
||||
"bytes"
|
|
@ -1,4 +1,4 @@
|
|||
package util
|
||||
package strutil
|
||||
|
||||
import "testing"
|
||||
|
Loading…
Reference in New Issue
Block a user