pull/268/head
Anton Medvedev 9 months ago
parent fd38fc4e0b
commit 3206f5001d
No known key found for this signature in database

@ -17,7 +17,7 @@ import (
"github.com/charmbracelet/lipgloss"
"github.com/mattn/go-isatty"
"github.com/antonmedv/fx/dig"
jsonpath "github.com/antonmedv/fx/path"
)
var (
@ -556,7 +556,7 @@ func (m *model) cursorPath() string {
}
func (m *model) dig(value string) *node {
p, ok := dig.SplitPath(value)
p, ok := jsonpath.Split(value)
if !ok {
return nil
}

@ -1,4 +1,4 @@
package dig
package path
import (
"strconv"
@ -21,7 +21,7 @@ const (
singleQuoteEscape
)
func SplitPath(p string) ([]any, bool) {
func Split(p string) ([]any, bool) {
path := make([]any, 0)
s := ""
state := start

@ -1,11 +1,11 @@
package dig_test
package path_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/antonmedv/fx/dig"
"github.com/antonmedv/fx/path"
)
func Test_SplitPath(t *testing.T) {
@ -80,7 +80,7 @@ func Test_SplitPath(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
p, ok := dig.SplitPath(tt.input)
p, ok := path.Split(tt.input)
require.Equal(t, tt.want, p)
require.True(t, ok)
})
@ -130,7 +130,7 @@ func Test_SplitPath_negative(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
p, ok := dig.SplitPath(tt.input)
p, ok := path.Split(tt.input)
require.False(t, ok, p)
})
}
Loading…
Cancel
Save