C-Tagging: Tag tasks and find them by tag - #3
Merged
Merged
Conversation
A task holds only a description, a done flag and, for deadlines and events, their dates. A user cannot label related tasks, e.g. all the tasks for one module, except by repeating the label in every description, where nothing treats it as a label. Let's give every task a set of tags such as #fun, shown after the description and saved as one extra field after the done flag. A task without tags keeps exactly the line it had before, and a field only counts as tags when every word in it is a valid tag, so existing save files load unchanged. A Tag record holds the rule for what a tag may be, letters and digits compared in lower case, so the tasks, the save file and later the parser share one definition. Allowing only letters and digits also keeps a tag from ever containing the spaces or pipes the save format relies on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Tasks can hold tags, but no command attaches or removes them, so every task's tags stay empty. Let's add the commands tag and untag, which take a task number and one or more tags, e.g. tag 2 #fun #school. One TagCommand handles both, the way MarkCommand covers mark and unmark, since the two differ only in the direction of the change and the wording. An untag naming a tag the task does not have is rejected before anything changes, because it usually means a typo, and removing the other tags anyway would leave the task half changed. Tagging a task with a tag it already has is accepted, since the result is what the user asked for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Tags now label tasks, but find searches descriptions only, so a tag cannot be used to pick out the tasks it labels. Let's treat a find keyword that starts with # as a tag, and show only the tasks that have exactly that tag, so #fun does not match #funny. Any other keyword searches descriptions as before. The tag search is its own FindByTagCommand rather than a branch inside FindCommand, because matching a whole tag is a different rule from finding text inside a description. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
master now has A-CI and A-CodeQuality. A-CodeQuality edits the same places as this branch in three files, so the merge conflicts there: * Task.java and Parser.java: both branches add imports at the same spot * Parser.java: both add a private helper before requireNotBlank, findOption on master and parseTag here * Ui.java: master rewords the Javadoc right after the place where this branch adds showTagged Let's keep both sides in each place: all the imports, in the order Checkstyle expects, both helpers, and showTagged followed by master's rewording. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
master now has A-Assertions, which adds an assert at the top of Storage.parseLine that the line is not blank. This branch changes the first lines of the same method, turning the first split into rawFields so that it can also look for a tags field, so the two changes conflict. Let's keep the assert, then this branch's rawFields split, which the tag handling further down relies on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extension: C-Tagging (tag:
BCD-Extension)tag INDEX #TAG...anduntag INDEX #TAG...add and remove tags. Tags are letters and digits, case-insensitive, and shown after the description.find #TAGlists the tasks with exactly that tag. Other keywords search descriptions as before.🤖 Generated with Claude Code