mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 11:31:54 +08:00
26 lines
520 B
Go
26 lines
520 B
Go
package dagcmd
|
|
|
|
import (
|
|
"github.com/ipfs/interface-go-ipfs-core/path"
|
|
"github.com/ipfs/kubo/core/commands/cmdenv"
|
|
|
|
cmds "github.com/ipfs/go-ipfs-cmds"
|
|
)
|
|
|
|
func dagResolve(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
|
|
api, err := cmdenv.GetApi(env, req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
rp, err := api.ResolvePath(req.Context, path.New(req.Arguments[0]))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return cmds.EmitOnce(res, &ResolveOutput{
|
|
Cid: rp.Cid(),
|
|
RemPath: rp.Remainder(),
|
|
})
|
|
}
|