MCPcopy
hub / github.com/syncthing/syncthing / Run

Method Run

cmd/syncthing/cli/operations.go:51–83  ·  view source on GitHub ↗
(ctx Context)

Source from the content-addressed store, hash-verified

49}
50
51func (f *folderOverrideCommand) Run(ctx Context) error {
52 client, err := ctx.clientFactory.getClient()
53 if err != nil {
54 return err
55 }
56 cfg, err := getConfig(client)
57 if err != nil {
58 return err
59 }
60 rid := f.FolderID
61 for _, folder := range cfg.Folders {
62 if folder.ID == rid {
63 response, err := client.Post("db/override", "")
64 if err != nil {
65 return err
66 }
67 if response.StatusCode != http.StatusOK {
68 errStr := fmt.Sprint("Failed to override changes\nStatus code: ", response.StatusCode)
69 bytes, err := responseToBArray(response)
70 if err != nil {
71 return err
72 }
73 body := string(bytes)
74 if body != "" {
75 errStr += "\nBody: " + body
76 }
77 return errors.New(errStr)
78 }
79 return nil
80 }
81 }
82 return fmt.Errorf("Folder %q not found", rid)
83}
84
85func (d *defaultIgnoresCommand) Run(ctx Context) error {
86 client, err := ctx.clientFactory.getClient()

Callers

nothing calls this directly

Calls 5

getConfigFunction · 0.85
responseToBArrayFunction · 0.85
getClientMethod · 0.80
PostMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected