Skip to content
A Dlang application that looks for TODO style tags in source code and exports them to various file formats(html, json etc).
Lua D Smarty Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
generators
modules
source
.gitignore
API.md
README.md
dub.sdl

README.md

Description

Todolistgen is a dlang program that scans source code for TODO style tags and generates a file listing of todo tasks.

Output Formats

Todolistgen will generate a file in the form of todo.format where format is json, html etc. The following output formats are included: json, html, markdown, csv and stdout(the default).

Building

You will need a dlang compiler. You should also make sure you have Lua version 5.1 library files installed which are needed for addons. To build run dub from the command line. This will build the application in debug mode. You should use dub --build=release. to create a release build(requires LDC to be installed).

Todolistgen Options

Usage:
	--dir Sets the directory that should be scanned. [Default: .].
	--pattern--pattern The pattern to use. [Default: *.*]
	--file Will only search the passed file name.
	--format The output format the results should be in. [Default: stdout].
	--ignore A list of file extensions to ignore separated by comma. [d,cpp,rust]
	--tags Used to display only the tag passed separated by commas. [INFO, FIXME, TODO]
	--create-generator Starts an interactive session used to create a new generator.
	--remove-generator Removes an installed generator.
	--list Generates a list of installed generators.
	-h             --help This help information.

Example Usage

The following will scan the directory where todolistgen was ran from and output results in html.

todolistgen --format=html

Here's an example of scanning one file only and outputing to stdout(the default).

	todolistgen TestComments.lua
	Processing file...TestComments.lua
	TestComments.lua        1       INFO    This is a quote test
	TestComments.lua        2       INFO    This is a semicolon test
	TestComments.lua        14      INFO    Panel is automatically created when including SimpleOptions.lua in your TOC.
	TestComments.lua        23      FIXME   This entire project

Another example using the markdown format

Processing file...TestComments.lua Exporting list to todo.md

TestComments.lua

Tag Line Number Message
INFO 1 This is a quote test
INFO 2 This is a semicolon test
NOTE 6 Checkbutton's seem to only align with the checkbox not the checkbox plus text. ClearAllPoints may not even be needed. Needs further investigation.
INFO 14 Panel is automatically created when including SimpleOptions.lua in your TOC.
FIXME 23 This entire project

Creating A Generator(Addon)

Introduction

Creating a generator is easy. Generators are written in the Lua programming language and stored in the users home directory. If you don't know Lua already you should go here. You can also use the Lua wiki. The Learn X in Y minutes website also has a section on Lua.

Your First Generator(Addon)

  1. Use the creator command:

todolistgen --create-generator

  1. A folder will be created in your OS config dir(the full path will be shown after creation) under the name you choose from the previous step. Now open [Generator Name].lua and find this function:

    function ProcessTasks(tasks, fileName, lastFile)
    	for _, task in ipairs(tasks) do
    		print(task.fileName, task.lineNumber, task.tag, task.message)
    	end
    end

    This is the main function todolistgen calls to process each file that contains todo tasks. It should be fairly obivious that ProcessTasks first argument is a table(tasks) and of course the second argument is the file name. The final argument is set to true if this is the last file being processed.

  2. Optionally your addon can define two more functions named OnCreate and OnDestroy. OnCreate is called before any files have been processed and OnDestroy is called after all files have been processed.

  3. All that's left is testing your addon by calling todolistgen like so:

todolistgen --format=generatorName

API

The API can be found here

You can’t perform that action at this time.