0.4.21 • Published 5 years ago

whatodo v0.4.21

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago
  • Install
  • API Usage
  • CLI Usage

https://whatodo.io (coming soon)

A TODO collector, organizer, and task manager

Do you write TODO comments all over your code?

I certainly do.

Wouldn't it be nice to pull those TODOs out and have priorities, links to where to your code, all ready to go?

Install

npm i -g whatodo

List priorities:

  • // TODO: low priority
  • // TODO:: mid priority
  • // TODO::: high priority

NPM Problems?

Try this: sudo npm install -g whatodo --unsafe-perm --allow-root

API Usage

Options:

  • input - input file or directory
  • ignore - array of files or directories to ignore
  • ignoreExts - array of extensions to ignore
  • todoPattern - regex pattern to search for (default: '\\/\\/ ?TODO:?:?:? ?')
  • outputFile - specify the file where the todos are saved
  • outputFormat - format to export todos (JSON, STDOUT)
  • maximumFileSize - maximum file size to search (1 KiB, 1 Megabyte, 2 MB)
'use strict';

const Whatodo = require( 'whatodo' );

new Whatodo( {
    input: 'index.js',
    ignore: [ 'node_modules', '.git', '.idea', 'docs', 'build' ],
    ignoreExts: [ 'json', 'html', 'css', 'md' ],
    todoPattern: '\\/\\/ ?TODO:?:?:? ?',
    outputFile: 'todos.json',
    outputFormat: 'JSON',
    maximumFileSize: '1 MiB'
} )
    .initialize()
	.then( inst => inst.run() )
	.then( inst => inst.save() )
	.catch( console.error );

CLI Usage

Write your TODO comments throughout your code

When ready, run the todo cli to collect your comments:

todo -h

  
  Whatodo v0.3.0
  
  Whatodo is a NPM Module designed to quickly and efficiently extract your
  TODO comments from your code and organize them in a simple & readable format
  
  Usage:
  
    todo [input file/folder] [...options]
  
  Options:
  
    -h, --help      show this help menu
    -v, --version   show package version
    -i, --input     directory or file to check TODOs  (default: ./)
    -o, --output    file to save TODOs                (default: STDOUT)
    -f, --format    format to save/print TODOs        (default: STDOUT, JSON)
    -p, --pattern   pattern to capture TODOs          (default: "\/\/ ?TODO:?:?:? ?")
    -m, --maximum   maximum file size allowed         (default: "1 MB", 512KiB)
  

CLI usage print STDOUT

todo ./ -m 1KiB -p "\/\/ ?TEST:?:?:? ?"
whatodo/test/test.cc  (118 μs - 182 bytes)
    [low]  line: 1 - todo low priority
    [mid]  line: 2 - todo mid priority
    [high] line: 3 - todo high priority

Total: 3
High: 1
Mid: 1
Low: 1

CLI usage print JSON format and save to file

todo ./ -f JSON -o todos.json -m 1KiB -p "\/\/ ?TEST:?:?:? ?"

Specify:

  • JSON formatted output
  • Output file todos.json
  • Set a maximum search of 1 Kibibyte files
  • TODO search regex "\/\/ ?TEST:?:?:? ?"

Creates a TODOS.json file:

[
    {
        "file": "whatodo/test/test.cc",
        "timing": "120.263 μs",
        "todos": [
            {
                "priority": "LOW",
                "line": 1,
                "position": 0,
                "comment": "todo low priority"
            },
            {
                "priority": "MID",
                "line": 2,
                "position": 0,
                "comment": "todo mid priority"
            },
            {
                "priority": "HIGH",
                "line": 3,
                "position": 0,
                "comment": "todo high priority"
            }
        ],
        "size": 182
    }
]

Add todos to your package.json -> "scripts"

{
	"scripts": {
		"todo": "./node_modules/whatodo/cli.js -i ./ -o TODOS.json -f JSON && ./node_modules/whatodo/cli.js"`
	}
}

Then run npm run todo!

0.4.21

5 years ago

0.4.20

6 years ago

0.4.19

6 years ago

0.4.18

6 years ago

0.4.17

6 years ago

0.4.16

6 years ago

0.4.15

6 years ago

0.4.13

6 years ago

0.4.11

6 years ago

0.4.10

6 years ago

0.4.9

6 years ago

0.4.8

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago