mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 21:59:23 +08:00
shell: move volume operations to use flag parsing arguments
This commit is contained in:
@@ -2,6 +2,7 @@ package shell
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
||||
"io"
|
||||
@@ -50,11 +51,14 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
|
||||
return
|
||||
}
|
||||
|
||||
takeAction := true
|
||||
if len(args) > 0 && args[0] == "-n" {
|
||||
takeAction = false
|
||||
volFixReplicationCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
||||
skipChange := volFixReplicationCommand.Bool("n", false, "skip the changes")
|
||||
if err = volFixReplicationCommand.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
takeAction := !*skipChange
|
||||
|
||||
var resp *master_pb.VolumeListResponse
|
||||
err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {
|
||||
resp, err = client.VolumeList(context.Background(), &master_pb.VolumeListRequest{})
|
||||
|
Reference in New Issue
Block a user