Skip to content

Commit 1cf9261

Browse files
Add helpers.go with shared formatToolsetName function
Co-authored-by: SamMorrowDrums <[email protected]>
1 parent 67df381 commit 1cf9261

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

cmd/github-mcp-server/helpers.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package main
2+
3+
import "strings"
4+
5+
// formatToolsetName converts a toolset ID to a human-readable name.
6+
// Used by both generate_docs.go and list_scopes.go for consistent formatting.
7+
func formatToolsetName(name string) string {
8+
switch name {
9+
case "pull_requests":
10+
return "Pull Requests"
11+
case "repos":
12+
return "Repositories"
13+
case "code_security":
14+
return "Code Security"
15+
case "secret_protection":
16+
return "Secret Protection"
17+
case "orgs":
18+
return "Organizations"
19+
default:
20+
// Fallback: capitalize first letter and replace underscores with spaces
21+
parts := strings.Split(name, "_")
22+
for i, part := range parts {
23+
if len(part) > 0 {
24+
parts[i] = strings.ToUpper(string(part[0])) + part[1:]
25+
}
26+
}
27+
return strings.Join(parts, " ")
28+
}
29+
}

0 commit comments

Comments
 (0)