Skip to content

Commit

Permalink
Updated help output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RichardLitt committed Jun 18, 2016
1 parent a376096 commit f76b8a6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions doctoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ function transformAndSave(files, mode, maxHeaderLevel, title, notitle, entryPref
}

unchanged.forEach(function (x) {
console.log('"%s" is up to date', x.path);
console.log('"%s" is up to date.', x.path);
});

changed.forEach(function (x) {
if (stdOut) {
console.log('==================\n\n"%s" should be updated', x.path)
console.log('==================\n\n"%s" was not updated.', x.path)
} else {
console.log('"%s" will be updated', x.path);
console.log('"%s" will be updated.', x.path);
fs.writeFileSync(x.path, x.data, 'utf8');
}
});
Expand All @@ -54,7 +54,11 @@ function printUsageAndExit(isErr) {

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

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))');
outputFunc('Usage: doctoc <path> [--help | -h] [mode] [--maxlevel <level> | -m]\n' +
'[--title <title> | -t] [--notitle | -T] [--stdout | -s]\n' +
'[--entryprefix <prefix>]\n\n' +
"<path> must be some path to a directory (e.g., .) or a file (e.g., README.md)");

outputFunc('\nAvailable modes are:');
for (var key in modes) {
outputFunc(' --%s\t%s', key, modes[key]);
Expand Down

0 comments on commit f76b8a6

Please sign in to comment.