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

Function runProjectUnregister

apps/cli/internal/cli/project_registry.go:135–157  ·  view source on GitHub ↗
(_ *cobra.Command, _ []string)

Source from the content-addressed store, hash-verified

133}
134
135func runProjectUnregister(_ *cobra.Command, _ []string) error {
136 configPath, err := globalConfigPath()
137 if err != nil {
138 return err
139 }
140 doc, err := readGlobalConfigNode(configPath)
141 if err != nil {
142 return fmt.Errorf("failed to read global config: %w", err)
143 }
144 matchKey, matchVal, err := resolveUnregisterMatch()
145 if err != nil {
146 return err
147 }
148 removedID, ok := removeProjectNode(doc, matchKey, matchVal)
149 if !ok {
150 return fmt.Errorf("no project found matching %s %q", matchKey, matchVal)
151 }
152 if err := writeGlobalConfigNode(configPath, doc); err != nil {
153 return fmt.Errorf("failed to write global config: %w", err)
154 }
155 fmt.Printf("Unregistered project %q\n", removedID)
156 return nil
157}
158
159func resolveUnregisterMatch() (string, string, error) {
160 if projectUnregisterID != "" {

Callers 3

Calls 5

globalConfigPathFunction · 0.85
readGlobalConfigNodeFunction · 0.85
resolveUnregisterMatchFunction · 0.85
removeProjectNodeFunction · 0.85
writeGlobalConfigNodeFunction · 0.85

Tested by 3