Solved: [todo categories should show all categories #552]#614
Open
ThePayyavula wants to merge 4 commits into
Open
Solved: [todo categories should show all categories #552]#614ThePayyavula wants to merge 4 commits into
ThePayyavula wants to merge 4 commits into
Conversation
Introduce a new CLI command `categories` that prints all categories (JSON when using porcelain formatter, otherwise newline-separated). Implement Database.categories() to query DISTINCT category values from the categories table (ordered) and return them as a list of strings, ensuring the DB cursor is closed. Add a test in tests/test_cli.py to verify categories are extracted from an ICS item and shown by the command.
Ruff formatting
WhyNotHugo
requested changes
Jun 6, 2026
WhyNotHugo
left a comment
Member
There was a problem hiding this comment.
Implementation should follow the same convention as existing commands, but the idea of this new command sounds good 👍
Comment on lines
+696
to
+699
| porcelain = ctx.formatter_class == formatters.PorcelainFormatter | ||
| text = json.dumps(categories) if porcelain else "\n".join(categories) | ||
| click.echo(text) | ||
|
|
Member
There was a problem hiding this comment.
DefaultFormatter and PorcelainFormatter should both implement a format_categories function which does the formatting, and here we just call click.echo(ctx.formatter.format_categories(categories)).
See how the list_command function is implemented below for reference.
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.
Added the todo categories that should show all categories