diff --git a/cli/piece-storage.go b/cli/piece-storage.go index c5d800be..42d0858d 100644 --- a/cli/piece-storage.go +++ b/cli/piece-storage.go @@ -53,10 +53,10 @@ var addFsPieceStorageCmd = &cli.Command{ readOnly := cctx.Bool("read-only") name := cctx.String("name") - if path == "" { + if !cctx.IsSet("path") { return fmt.Errorf("path is required") } - if name == "" { + if !cctx.IsSet("name") { return fmt.Errorf("name is required") } @@ -128,17 +128,17 @@ var pieceStorageAddS3Cmd = &cli.Command{ token := cctx.String("token") name := cctx.String("name") - if endpoint == "" { - return fmt.Errorf("endpoint are required") + if !cctx.IsSet("endpoint") { + return fmt.Errorf("endpoint is required") } - if accessKey == "" { - return fmt.Errorf("access key are required") + if !cctx.IsSet("access-key") { + return fmt.Errorf("access-key is required") } - if secretKey == "" { - return fmt.Errorf("secret key are required") + if !cctx.IsSet("secret-key") { + return fmt.Errorf("secret-key is required") } - if name == "" { - return fmt.Errorf("name are required") + if !cctx.IsSet("name") { + return fmt.Errorf("name is required") } err = nodeApi.AddS3PieceStorage(ctx, readOnly, endpoint, name, accessKey, secretKey, token) @@ -197,8 +197,9 @@ var pieceStorageListCmd = &cli.Command{ } var pieceStorageRemoveCmd = &cli.Command{ - Name: "remove", - Usage: "remove a piece storage", + Name: "remove", + ArgsUsage: "", + Usage: "remove a piece storage", Action: func(cctx *cli.Context) error { // get idx name := cctx.Args().Get(0)