diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-09-20 09:27:34 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-09-20 09:27:34 -0700 |
| commit | f498c71199069b3c6b9719417438b56189889dd8 (patch) | |
| tree | 3046911fcca0867ef5cf78dd1e8ccab7adcd3f2d /weed/shell/command_volume_fix_replication.go | |
| parent | fcbc520373eb0602f53f60d997f819505749191c (diff) | |
| download | seaweedfs-f498c71199069b3c6b9719417438b56189889dd8.tar.xz seaweedfs-f498c71199069b3c6b9719417438b56189889dd8.zip | |
shell: move volume operations to use flag parsing arguments
Diffstat (limited to 'weed/shell/command_volume_fix_replication.go')
| -rw-r--r-- | weed/shell/command_volume_fix_replication.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go index b32ccaaab..471b24a2a 100644 --- a/weed/shell/command_volume_fix_replication.go +++ b/weed/shell/command_volume_fix_replication.go @@ -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{}) |
