Skip to content

Commit 3a81fea

Browse files
committed
Added help flag.
Prevent error when file is not specified or found.
1 parent f8488a5 commit 3a81fea

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

bin/doxdox

100644100755
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var title = 'Untitled Project',
1919
var args = process.argv.slice(2),
2020
value;
2121

22-
var filename;
22+
var filename = '';
2323

2424
while (args.length) {
2525

@@ -47,6 +47,22 @@ while (args.length) {
4747
process.stdout.write(pkg.version + '\n');
4848
break;
4949

50+
case '-h':
51+
case '--help':
52+
process.stdout.write('\n');
53+
process.stdout.write(' Usage: doxdox <file> [options]' + '\n\n');
54+
process.stdout.write(' Options:' + '\n\n');
55+
process.stdout.write(' -h, --help\t\tDisplay this help message.' + '\n');
56+
process.stdout.write(' -t, --title\t\tSets title.' + '\n');
57+
process.stdout.write(' -d, --description\tSets description.' + '\n');
58+
process.stdout.write(' -l, --layout\t\tTemplate to render the documentation with.' + '\n');
59+
process.stdout.write('\n');
60+
process.stdout.write(' Available Layouts:' + '\n\n');
61+
process.stdout.write(' - Bootstrap 3 (http://getbootstrap.com/)' + '\n');
62+
process.stdout.write(' - Markdown (http://daringfireball.net/projects/markdown/)' + '\n');
63+
process.stdout.write('\n');
64+
break;
65+
5066
default:
5167
filename = value;
5268
break;
@@ -69,6 +85,10 @@ fs.exists(filename, function (exists) {
6985
methods: utils.parseData(data)
7086
}));
7187

88+
} else {
89+
90+
console.log('File not found.');
91+
7292
}
7393

7494
});

0 commit comments

Comments
 (0)