Skip to content

Commit f76b8a6

Browse files
committed
Updated help output
I reorganized, limited to 80 chars, added `--stdout`, added shortcut options, put a space between the path description to make it more readable, and also fixed ambiguous working in the stdOut function, as well as added periods.
1 parent a376096 commit f76b8a6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

doctoc.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ function transformAndSave(files, mode, maxHeaderLevel, title, notitle, entryPref
3737
}
3838

3939
unchanged.forEach(function (x) {
40-
console.log('"%s" is up to date', x.path);
40+
console.log('"%s" is up to date.', x.path);
4141
});
4242

4343
changed.forEach(function (x) {
4444
if (stdOut) {
45-
console.log('==================\n\n"%s" should be updated', x.path)
45+
console.log('==================\n\n"%s" was not updated.', x.path)
4646
} else {
47-
console.log('"%s" will be updated', x.path);
47+
console.log('"%s" will be updated.', x.path);
4848
fs.writeFileSync(x.path, x.data, 'utf8');
4949
}
5050
});
@@ -54,7 +54,11 @@ function printUsageAndExit(isErr) {
5454

5555
var outputFunc = isErr ? console.error : console.info;
5656

57-
outputFunc('Usage: doctoc [mode] [--entryprefix prefix] [--notitle | --title title] [--maxlevel level] <path> (where path is some path to a directory (e.g., .) or a file (e.g., README.md))');
57+
outputFunc('Usage: doctoc <path> [--help | -h] [mode] [--maxlevel <level> | -m]\n' +
58+
'[--title <title> | -t] [--notitle | -T] [--stdout | -s]\n' +
59+
'[--entryprefix <prefix>]\n\n' +
60+
"<path> must be some path to a directory (e.g., .) or a file (e.g., README.md)");
61+
5862
outputFunc('\nAvailable modes are:');
5963
for (var key in modes) {
6064
outputFunc(' --%s\t%s', key, modes[key]);

0 commit comments

Comments
 (0)