Skip to content

Commit

Permalink
feat: add ArgsUsage to pieces-storage remove cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZexiao committed Jul 4, 2022
1 parent b6d0bcc commit 46d976f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions cli/piece-storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -197,8 +197,9 @@ var pieceStorageListCmd = &cli.Command{
}

var pieceStorageRemoveCmd = &cli.Command{
Name: "remove",
Usage: "remove a piece storage",
Name: "remove",
ArgsUsage: "<name>",
Usage: "remove a piece storage",
Action: func(cctx *cli.Context) error {
// get idx
name := cctx.Args().Get(0)
Expand Down

0 comments on commit 46d976f

Please sign in to comment.