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

Function newFsFileAddFilter

cmd/cmd.go:111–129  ·  view source on GitHub ↗

newFsFileAddFilter creates an src Fs from a name This works the same as NewFsFile however it adds filters to the Fs to limit it to a single file if the remote pointed to a file.

(remote string)

Source from the content-addressed store, hash-verified

109// This works the same as NewFsFile however it adds filters to the Fs
110// to limit it to a single file if the remote pointed to a file.
111func newFsFileAddFilter(remote string) (fs.Fs, string) {
112 ctx := context.Background()
113 fi := filter.GetConfig(ctx)
114 f, fileName := NewFsFile(remote)
115 if fileName != "" {
116 if !fi.InActive() {
117 err := fmt.Errorf("can't limit to single files when using filters: %v", remote)
118 err = fs.CountError(ctx, err)
119 fs.Fatal(nil, err.Error())
120 }
121 // Limit transfers to this file
122 err := fi.AddFile(fileName)
123 if err != nil {
124 err = fs.CountError(ctx, err)
125 fs.Fatalf(nil, "Failed to limit to single file %q: %v", remote, err)
126 }
127 }
128 return f, fileName
129}
130
131// NewFsSrc creates a new src fs from the arguments.
132//

Callers 3

NewFsSrcFunction · 0.85
NewFsSrcDstFunction · 0.85
NewFsSrcDstFilesFunction · 0.85

Calls 8

GetConfigFunction · 0.92
FatalFunction · 0.92
FatalfFunction · 0.92
NewFsFileFunction · 0.85
InActiveMethod · 0.80
AddFileMethod · 0.80
ErrorMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…