curio cli: Add --local to storage list cli

This commit is contained in:
Łukasz Magiera 2024-04-03 16:25:59 +02:00 committed by Łukasz Magiera
parent 416d7ef860
commit f1c04c8f96

View File

@ -209,6 +209,12 @@ var storageDetachCmd = &cli.Command{
var storageListCmd = &cli.Command{ var storageListCmd = &cli.Command{
Name: "list", Name: "list",
Usage: "list local storage paths", Usage: "list local storage paths",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "local",
Usage: "only list local storage paths",
},
},
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
//storageListSectorsCmd, //storageListSectorsCmd,
}, },
@ -238,6 +244,12 @@ var storageListCmd = &cli.Command{
sorted := make([]fsInfo, 0, len(st)) sorted := make([]fsInfo, 0, len(st))
for id, decls := range st { for id, decls := range st {
if cctx.Bool("local") {
if _, ok := local[id]; !ok {
continue
}
}
st, err := minerApi.StorageStat(ctx, id) st, err := minerApi.StorageStat(ctx, id)
if err != nil { if err != nil {
sorted = append(sorted, fsInfo{ID: id, sectors: decls}) sorted = append(sorted, fsInfo{ID: id, sectors: decls})