@@ -7,15 +7,14 @@ import (
7
7
"io"
8
8
"strings"
9
9
10
- core "github.com/ipfs/go-ipfs/core"
11
10
cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
12
- "github.com/ipfs/go-ipfs/namesys/resolve"
13
11
14
12
cid "github.com/ipfs/go-cid"
15
13
cidenc "github.com/ipfs/go-cidutil/cidenc"
16
14
cmds "github.com/ipfs/go-ipfs-cmds"
17
15
ipld "github.com/ipfs/go-ipld-format"
18
- path "github.com/ipfs/go-path"
16
+ iface "github.com/ipfs/interface-go-ipfs-core"
17
+ path "github.com/ipfs/interface-go-ipfs-core/path"
19
18
)
20
19
21
20
var refsEncoderMap = cmds.EncoderMap {
@@ -75,7 +74,7 @@ NOTE: List all references recursively by using the flag '-r'.
75
74
}
76
75
77
76
ctx := req .Context
78
- n , err := cmdenv .GetNode (env )
77
+ api , err := cmdenv .GetApi (env , req )
79
78
if err != nil {
80
79
return err
81
80
}
@@ -103,14 +102,14 @@ NOTE: List all references recursively by using the flag '-r'.
103
102
format = "<src> -> <dst>"
104
103
}
105
104
106
- objs , err := objectsForPaths (ctx , n , req .Arguments )
105
+ objs , err := objectsForPaths (ctx , api , req .Arguments )
107
106
if err != nil {
108
107
return err
109
108
}
110
109
111
110
rw := RefWriter {
112
111
res : res ,
113
- DAG : n . DAG ,
112
+ DAG : api . Dag () ,
114
113
Ctx : ctx ,
115
114
Unique : unique ,
116
115
PrintFmt : format ,
@@ -165,15 +164,10 @@ Displays the hashes of all local objects.
165
164
Type : RefWrapper {},
166
165
}
167
166
168
- func objectsForPaths (ctx context.Context , n * core. IpfsNode , paths []string ) ([]ipld.Node , error ) {
167
+ func objectsForPaths (ctx context.Context , n iface. CoreAPI , paths []string ) ([]ipld.Node , error ) {
169
168
objects := make ([]ipld.Node , len (paths ))
170
169
for i , sp := range paths {
171
- p , err := path .ParsePath (sp )
172
- if err != nil {
173
- return nil , err
174
- }
175
-
176
- o , err := resolve .Resolve (ctx , n .Namesys , n .Resolver , p )
170
+ o , err := n .ResolveNode (ctx , path .New (sp ))
177
171
if err != nil {
178
172
return nil , err
179
173
}
0 commit comments