retrieval: Make the cat command work
This commit is contained in:
parent
2c583b03ff
commit
3e70b8420e
@ -344,7 +344,16 @@ var clientRetrieveCatCmd = &cli.Command{
|
|||||||
Name: "cat",
|
Name: "cat",
|
||||||
Usage: "Show data from network",
|
Usage: "Show data from network",
|
||||||
ArgsUsage: "[dataCid]",
|
ArgsUsage: "[dataCid]",
|
||||||
Flags: retrFlagsCommon,
|
Flags: append([]cli.Flag{
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "ipld",
|
||||||
|
Usage: "list IPLD datamodel links",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "datamodel-path",
|
||||||
|
Usage: "a rudimentary (DM-level-only) text-path selector",
|
||||||
|
},
|
||||||
|
}, retrFlagsCommon...),
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
if cctx.NArg() != 1 {
|
if cctx.NArg() != 1 {
|
||||||
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))
|
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))
|
||||||
@ -363,13 +372,20 @@ var clientRetrieveCatCmd = &cli.Command{
|
|||||||
ctx := ReqContext(cctx)
|
ctx := ReqContext(cctx)
|
||||||
afmt := NewAppFmt(cctx.App)
|
afmt := NewAppFmt(cctx.App)
|
||||||
|
|
||||||
// todo selector
|
sel := lapi.Selector(cctx.String("datamodel-path"))
|
||||||
eref, err := retrieve(ctx, cctx, fapi, nil, afmt.Printf)
|
selp := &sel
|
||||||
|
if sel == "" {
|
||||||
|
selp = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
eref, err := retrieve(ctx, cctx, fapi, selp, afmt.Printf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if sel := lapi.Selector(cctx.String("datamodel-path-selector")); sel != "" {
|
fmt.Println() // separate retrieval events from results
|
||||||
|
|
||||||
|
if sel != "" {
|
||||||
eref.DAGs = append(eref.DAGs, lapi.DagSpec{DataSelector: &sel})
|
eref.DAGs = append(eref.DAGs, lapi.DagSpec{DataSelector: &sel})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user