From 29b746235c5c4e039ea9fc88d04ba15f8fe56f55 Mon Sep 17 00:00:00 2001 From: specCon18 Date: Tue, 18 Mar 2025 17:21:01 -0400 Subject: [PATCH] fixed regression where priority was still listed raw before task --- cmd/root.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index d350498..b2dd14b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -85,11 +85,16 @@ func extractPriority(line string) (int, error) { return 9, nil // Default priority if none is found } -// Function to extract the task from the TODO comment +// Function to extract the task from the TODO comment and remove the priority func extractTask(line string) string { trimmedLine := strings.TrimSpace(line) trimmedLine = strings.TrimPrefix(trimmedLine, "//TODO: ") - return strings.TrimSpace(trimmedLine) + + // Remove the priority part (P:) if it exists + re := regexp.MustCompile(`P:\d+`) + trimmedLine = re.ReplaceAllString(trimmedLine, "") + + return strings.TrimSpace(trimmedLine) // Return the task without priority } //TODO: P:0 add support for TODO's not at start of line