GithubHelp home page GithubHelp logo

todos's Introduction

Todos

Go Report Card Go Reference ci-badger-tests Sourcegraph

This is a command-line program written in Go that searches for // TODO: xxxx style comments in a directory and outputs them to the console or in JSON format.

Usage

todos [options] <dir>

The program accepts the following command-line arguments:

  • -ignore: A comma-separated list of files and directories to ignore, in gitignore format.
  • -sortby: Sort results by field (author, file, line, type, or text)
  • -output: Output style (table, file, json). Default: table
  • -types: A comma-separated list of comment types to search for. The default is "TODO,FIXME".
  • -hidden: Search hidden files and directories.
  • -permissive: Permissive mode (looser regex, but can match more than intended, strict format is 'TYPE(author): text' where author is optional)
  • -format: Uses the provide go template to output the result
  • -no-gitignore: Ignore .gitignore file
  • -validate-max: Validate that the number of comments is less than or equal to the max.

Install

To install the program, run the following command:

go install github.com/euforic/todos@latest

Running the Program

To run the program for the current dir, execute the following command:

todos

You can also pass command-line arguments to the program. For example, to search for comments in the directory "myproject" and output the results in JSON format, run the following command:

todos -output json ./myproject

Search a Specific Directory

To search a specific directory, use todos [options] <dir> the first arg is the directory path. For example, to search the directory ~/projects/myproject, run the following command:

todos ~/projects/myproject

Ignore Files and Directories

To ignore files and directories, use the -ignore flag followed by a comma-separated list of files and directories in gitignore format. For example, to ignore files with the extensions .txt and .log, and directories named vendor and node_modules, run the following command:

todos -ignore "*.txt,*.log,vendor/,node_modules/"

Output in Format Style

To output the results in the chosen format (json, file, table), use the -output flag. For example, to output the results in json format, run the following command:

todos -output json

Sort Results

To sort the results, use the -sortby flag followed by the field to sort by. The valid fields are author, file, line, type, and text. For example, to sort the results by comment type, run the following command:

todos -sortby type

To sort in descending order add the postfix :desc. For example to sort by author in decending order, you would run the following command:

todos -sortby author:desc

Search for Different Comment Types

To search for different types of comments, use the -types flag followed by a comma-separated list of comment types. For example, to search for comments with the types TODO, FIXME, and NOTE, run the following command:

todos -types=TODO,FIXME,NOTE

Format

To format the output of the comments, use the -format flag followed by a Go template string. For example, to see all of the comments, use the following command:

todos -format "{{range .}}{{ .File}}\n  Line: {{.Line}}\n  Text: {{.Text}}\n  Author: {{- .Author}}\n\n{{end}}"

To use a template file, use the following command:

todos -format "$(cat some.template)"

Validate Max

To validate the maximum amount of comments does not exceed a certin value, use the -validate-max flag followed by the maximium number of comments. For example, to limit the maximum amount of comments to 20, run the following command:

todos -validate-max 20

todos's People

Contributors

euforic avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

todos's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.