retrieval: Don't use subcommands

This commit is contained in:
Łukasz Magiera 2021-11-16 12:40:25 +01:00
parent 597b72e286
commit 53a48df77e
3 changed files with 61 additions and 42 deletions

View File

@ -93,6 +93,8 @@ var clientCmd = &cli.Command{
WithCategory("data", clientStat),
WithCategory("retrieval", clientFindCmd),
WithCategory("retrieval", clientRetrieveCmd),
WithCategory("retrieval", clientRetrieveCatCmd),
WithCategory("retrieval", clientRetrieveLsCmd),
WithCategory("retrieval", clientCancelRetrievalDealCmd),
WithCategory("retrieval", clientListRetrievalsCmd),
WithCategory("util", clientCommPCmd),

View File

@ -200,43 +200,43 @@ func retrieve(ctx context.Context, cctx *cli.Context, fapi lapi.FullNode, sel *l
return eref, nil
}
var clientRetrieveCmd = &cli.Command{
Name: "retrieve",
Subcommands: []*cli.Command{
clientRetrieveCatCmd,
clientRetrieveLsCmd,
var retrFlagsCommon = []cli.Flag{
&cli.StringFlag{
Name: "from",
Usage: "address to send transactions from",
},
&cli.StringFlag{
Name: "miner",
Usage: "miner address for retrieval, if not present it'll use local discovery",
},
&cli.StringFlag{
Name: "maxPrice",
Usage: fmt.Sprintf("maximum price the client is willing to consider (default: %s FIL)", DefaultMaxRetrievePrice),
},
&cli.StringFlag{
Name: "pieceCid",
Usage: "require data to be retrieved from a specific Piece CID",
},
&cli.BoolFlag{
Name: "allow-local",
// todo: default to true?
},
}
var clientRetrieveCmd = &cli.Command{
Name: "retrieve",
Usage: "Retrieve data from network",
ArgsUsage: "[dataCid outputPath]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "from",
Usage: "address to send transactions from",
},
Flags: append([]cli.Flag{
&cli.BoolFlag{
Name: "car",
Usage: "export to a car file instead of a regular file",
},
&cli.StringFlag{
Name: "miner",
Usage: "miner address for retrieval, if not present it'll use local discovery",
},
&cli.StringFlag{
Name: "datamodel-path-selector",
Usage: "a rudimentary (DM-level-only) text-path selector, allowing for sub-selection within a deal",
},
&cli.StringFlag{
Name: "maxPrice",
Usage: fmt.Sprintf("maximum price the client is willing to consider (default: %s FIL)", DefaultMaxRetrievePrice),
},
&cli.StringFlag{
Name: "pieceCid",
Usage: "require data to be retrieved from a specific Piece CID",
},
&cli.BoolFlag{
Name: "allow-local",
},
},
}, retrFlagsCommon...),
Action: func(cctx *cli.Context) error {
if cctx.NArg() != 2 {
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))
@ -329,6 +329,7 @@ var clientRetrieveCatCmd = &cli.Command{
Name: "cat",
Usage: "Show data from network",
ArgsUsage: "[dataCid]",
Flags: retrFlagsCommon,
Action: func(cctx *cli.Context) error {
if cctx.NArg() != 1 {
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))
@ -372,6 +373,7 @@ var clientRetrieveLsCmd = &cli.Command{
Name: "ls",
Usage: "Show object links",
ArgsUsage: "[dataCid]",
Flags: retrFlagsCommon,
Action: func(cctx *cli.Context) error {
if cctx.NArg() != 1 {
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))

View File

@ -426,6 +426,8 @@ COMMANDS:
RETRIEVAL:
find Find data in the network
retrieve Retrieve data from network
cat Show data from network
ls Show object links
cancel-retrieval Cancel a retrieval deal by deal ID; this also cancels the associated transfer
list-retrievals List retrieval market deals
STORAGE:
@ -539,49 +541,62 @@ NAME:
lotus client retrieve - Retrieve data from network
USAGE:
lotus client retrieve command [command options] [dataCid outputPath]
lotus client retrieve [command options] [dataCid outputPath]
COMMANDS:
cat Show data from network
ls Show object links
help, h Shows a list of commands or help for one command
CATEGORY:
RETRIEVAL
OPTIONS:
--from value address to send transactions from
--car export to a car file instead of a regular file (default: false)
--miner value miner address for retrieval, if not present it'll use local discovery
--datamodel-path-selector value a rudimentary (DM-level-only) text-path selector, allowing for sub-selection within a deal
--from value address to send transactions from
--miner value miner address for retrieval, if not present it'll use local discovery
--maxPrice value maximum price the client is willing to consider (default: 0.01 FIL)
--pieceCid value require data to be retrieved from a specific Piece CID
--allow-local (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)
```
#### lotus client retrieve cat
### lotus client cat
```
NAME:
lotus client retrieve cat - Show data from network
lotus client cat - Show data from network
USAGE:
lotus client retrieve cat [command options] [dataCid]
lotus client cat [command options] [dataCid]
CATEGORY:
RETRIEVAL
OPTIONS:
--help, -h show help (default: false)
--from value address to send transactions from
--miner value miner address for retrieval, if not present it'll use local discovery
--maxPrice value maximum price the client is willing to consider (default: 0.01 FIL)
--pieceCid value require data to be retrieved from a specific Piece CID
--allow-local (default: false)
--help, -h show help (default: false)
```
#### lotus client retrieve ls
### lotus client ls
```
NAME:
lotus client retrieve ls - Show object links
lotus client ls - Show object links
USAGE:
lotus client retrieve ls [command options] [dataCid]
lotus client ls [command options] [dataCid]
CATEGORY:
RETRIEVAL
OPTIONS:
--help, -h show help (default: false)
--from value address to send transactions from
--miner value miner address for retrieval, if not present it'll use local discovery
--maxPrice value maximum price the client is willing to consider (default: 0.01 FIL)
--pieceCid value require data to be retrieved from a specific Piece CID
--allow-local (default: false)
--help, -h show help (default: false)
```