Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Filter TODOs by label #1562

Closed
anatoly-scherbakov opened this issue Sep 25, 2024 · 1 comment · Fixed by #1571
Closed

[feature] Filter TODOs by label #1562

anatoly-scherbakov opened this issue Sep 25, 2024 · 1 comment · Fixed by #1571
Assignees
Labels
enhancement New feature or request

Comments

@anatoly-scherbakov
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I would like to use TODO comments as documentation. For instance,

SEARCH_ENGINES = [
    'google',
    'hitchhikers-guide-to-the-galaxy',
    # TODO(add-search-engine): Add your engine name here.
]

Describe the solution you'd like
I'd like to be able to easily retrieve all the TODOs by label.

Describe alternatives you've considered
Could be done with JSON output and jq but it is a bit harder/more involved than just writing

todos --label add-search-engine
@anatoly-scherbakov anatoly-scherbakov added enhancement New feature or request triage This issue needs triage labels Sep 25, 2024
@ianlewis
Copy link
Owner

Thanks for the suggestion. It may be a good idea to add a simple filter for labels.

For now you can get the same functionality with jq as a workaround.

todos -o json | jq -r '. | select(.label = "add-search-engine") | .path + ":" + (.comment_line|tostring) + ":" + .text'

@ianlewis ianlewis removed the triage This issue needs triage label Sep 28, 2024
ianlewis added a commit that referenced this issue Oct 30, 2024
A new `--label` flag is added that takes a GLOB and matches against
TODO labels. The flag can be included multilpe times. A TODO that
matches any label is included in the output.

Fixes #1562

Signed-off-by: Ian Lewis <[email protected]>
@ianlewis ianlewis linked a pull request Oct 30, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants