MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / WriteWorkspaceLink

Function WriteWorkspaceLink

internal/cli/workspace.go:94–102  ·  view source on GitHub ↗

WriteWorkspaceLink writes a .pad.toml in the given directory. serverURL is the base URL of the Pad server hosting this workspace. Pass the empty string for local-mode workspaces; pass cfg.BaseURL() (or equivalently cfg.URL) for any non-local mode (remote, cloud) so that the directory targets the ri

(dir, slug, serverURL string)

Source from the content-addressed store, hash-verified

92// directory targets the right server even when the user's global config
93// points at a different one. See BUG-1535.
94func WriteWorkspaceLink(dir, slug, serverURL string) error {
95 path := filepath.Join(dir, ".pad.toml")
96 f, err := os.Create(path)
97 if err != nil {
98 return err
99 }
100 defer f.Close()
101 return toml.NewEncoder(f).Encode(PadToml{Workspace: slug, URL: serverURL})
102}

Callers 6

linkCmdFunction · 0.92
switchCmdFunction · 0.92
ensureWorkspaceFunction · 0.92

Calls 3

JoinMethod · 0.80
CloseMethod · 0.65
EncodeMethod · 0.65