MCPcopy Index your code
hub / github.com/rclone/rclone / Set

Method Set

lib/encoder/encoder.go:185–202  ·  view source on GitHub ↗

Set converts a string into a MultiEncoder

(in string)

Source from the content-addressed store, hash-verified

183
184// Set converts a string into a MultiEncoder
185func (mask *MultiEncoder) Set(in string) error {
186 var out MultiEncoder
187 parts := strings.SplitSeq(in, ",")
188 for part := range parts {
189 part = strings.TrimSpace(part)
190 if bits, ok := nameToEncoding[part]; ok {
191 out |= bits
192 } else {
193 i, err := strconv.ParseUint(part, 0, 0)
194 if err != nil {
195 return fmt.Errorf("bad encoding %q: possible values are: %s", part, ValidStrings())
196 }
197 out |= MultiEncoder(i)
198 }
199 }
200 *mask = out
201 return nil
202}
203
204// Type returns a textual type of the MultiEncoder to satisfy the pflag.Value interface
205func (mask MultiEncoder) Type() string {

Callers 3

ScanMethod · 0.95
TestEncodeSetFunction · 0.95
transformPathSegmentFunction · 0.95

Calls 3

ValidStringsFunction · 0.85
MultiEncoderTypeAlias · 0.85
ErrorfMethod · 0.45

Tested by 1

TestEncodeSetFunction · 0.76