ianlewis / todos

Parse TODO and FIXME comments from code
Apache License 2.0
29 stars 5 forks source link

[feature] Filter TODOs by label #1562

Closed anatoly-scherbakov closed 2 weeks ago

anatoly-scherbakov commented 1 month ago

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
ianlewis commented 1 month ago

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'