testmark-bash

todos.md

todos.sh, by example๐Ÿ”—

todos.sh lists the lines of files that mention TODO, as FILE:LINE:TEXT.

Each case below is a pair of hunks: CASE/input is a file's content, and CASE/output is what todos.sh prints for that file. test-todos.sh runs every case, handing todos.sh the input as /dev/stdin.

the basics๐Ÿ”—

#!/bin/bash
# TODO: handle spaces in names
echo "$1"
# TODO: and newlines

Lines are numbered from one.

/dev/stdin:2:# TODO: handle spaces in names
/dev/stdin:4:# TODO: and newlines

lines come out as they are๐Ÿ”—

Leading whitespace and backslashes are kept.

notes:
	TODO: indented with a tab
  \TODO: with a backslash
/dev/stdin:2:	TODO: indented with a tab
/dev/stdin:3:  \TODO: with a backslash

nothing to do๐Ÿ”—

No TODOs, no output: the output hunk is empty.

all done here

examples/todos.md ยท 1.0 KiB ยท 1c29154087