MCPcopy Create free account
hub / github.com/driangle/taskmd / registerProject

Function registerProject

apps/cli/internal/cli/project_registry.go:115–133  ·  view source on GitHub ↗
(id, name, targetPath string)

Source from the content-addressed store, hash-verified

113}
114
115func registerProject(id, name, targetPath string) error {
116 configPath, err := globalConfigPath()
117 if err != nil {
118 return err
119 }
120 doc, err := readGlobalConfigNode(configPath)
121 if err != nil {
122 return fmt.Errorf("failed to read global config: %w", err)
123 }
124 if err := checkDuplicateID(doc, id); err != nil {
125 return err
126 }
127 appendProjectNode(doc, id, name, targetPath)
128 if err := writeGlobalConfigNode(configPath, doc); err != nil {
129 return fmt.Errorf("failed to write global config: %w", err)
130 }
131 fmt.Printf("Registered project %q at %s\n", id, targetPath)
132 return nil
133}
134
135func runProjectUnregister(_ *cobra.Command, _ []string) error {
136 configPath, err := globalConfigPath()

Callers 1

runProjectRegisterFunction · 0.85

Calls 5

globalConfigPathFunction · 0.85
readGlobalConfigNodeFunction · 0.85
checkDuplicateIDFunction · 0.85
appendProjectNodeFunction · 0.85
writeGlobalConfigNodeFunction · 0.85

Tested by

no test coverage detected