fix: display skill description correctly and support --help/-h commands

This commit is contained in:
tuwolife 2026-02-20 00:54:41 +08:00
parent 521359ed4f
commit da25289692

View file

@ -120,9 +120,9 @@ func copyDirectory(src, dst string) error {
} }
func main() { func main() {
if len(os.Args) < 2 { if len(os.Args) < 2 || os.Args[1] == "--help" || os.Args[1] == "-h" {
printHelp() printHelp()
os.Exit(1) os.Exit(0)
} }
command := os.Args[1] command := os.Args[1]
@ -1370,9 +1370,15 @@ func skillsListBuiltinCmd() {
if idx := strings.Index(content, "\n"); idx > 0 { if idx := strings.Index(content, "\n"); idx > 0 {
firstLine := content[:idx] firstLine := content[:idx]
if strings.Contains(firstLine, "description:") { if strings.Contains(firstLine, "description:") {
descLine := strings.Index(content[idx:], "\n") // Find the start of the description line (after the first newline)
if descLine > 0 { descStart := idx + 1
description = strings.TrimSpace(content[idx+descLine : idx+descLine]) // Find the end of the description line
descEnd := strings.Index(content[descStart:], "\n")
if descEnd != -1 {
description = strings.TrimSpace(content[descStart : descStart+descEnd])
} else {
// If there's no more newline, take the rest of the content
description = strings.TrimSpace(content[descStart:])
} }
} }
} }