MCPcopy
hub / github.com/rclone/rclone / getOptions

Function getOptions

lib/transform/options.go:53–74  ·  view source on GitHub ↗

getOptions sets the options from flags passed in.

(ctx context.Context)

Source from the content-addressed store, hash-verified

51
52// getOptions sets the options from flags passed in.
53func getOptions(ctx context.Context) (opt []transform, err error) {
54 if !Transforming(ctx) {
55 return opt, nil
56 }
57
58 ci := fs.GetConfig(ctx)
59
60 // return cached opt if available
61 if cachedNameTransform != nil && slices.Equal(ci.NameTransform, cachedNameTransform) {
62 return cachedOpt, nil
63 }
64
65 for _, transform := range ci.NameTransform {
66 t, err := parse(transform)
67 if err != nil {
68 return opt, err
69 }
70 opt = append(opt, t)
71 }
72 updateCache(ci.NameTransform, opt)
73 return opt, nil
74}
75
76func updateCache(nt []string, o []transform) {
77 cacheLock.Lock()

Callers 2

SetOptionsFunction · 0.85
PathFunction · 0.85

Calls 5

GetConfigFunction · 0.92
TransformingFunction · 0.85
updateCacheFunction · 0.85
parseFunction · 0.70
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…