github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/pkg/storage/flags.go (about) 1 // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. 2 3 package storage 4 5 import ( 6 "github.com/pingcap/errors" 7 "github.com/spf13/pflag" 8 ) 9 10 // DefineFlags adds flags to the flag set corresponding to all backend options. 11 func DefineFlags(flags *pflag.FlagSet) { 12 defineS3Flags(flags) 13 defineGCSFlags(flags) 14 } 15 16 // ParseFromFlags obtains the backend options from the flag set. 17 func (options *BackendOptions) ParseFromFlags(flags *pflag.FlagSet) error { 18 if err := options.S3.parseFromFlags(flags); err != nil { 19 return errors.Trace(err) 20 } 21 return options.GCS.parseFromFlags(flags) 22 }