aboutsummaryrefslogtreecommitdiff
path: root/cordova/node_modules/shelljs/scripts/generate-docs.js
diff options
context:
space:
mode:
Diffstat (limited to 'cordova/node_modules/shelljs/scripts/generate-docs.js')
-rwxr-xr-xcordova/node_modules/shelljs/scripts/generate-docs.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/cordova/node_modules/shelljs/scripts/generate-docs.js b/cordova/node_modules/shelljs/scripts/generate-docs.js
new file mode 100755
index 0000000..532fed9
--- /dev/null
+++ b/cordova/node_modules/shelljs/scripts/generate-docs.js
@@ -0,0 +1,21 @@
+#!/usr/bin/env node
+require('../global');
+
+echo('Appending docs to README.md');
+
+cd(__dirname + '/..');
+
+// Extract docs from shell.js
+var docs = grep('//@', 'shell.js');
+
+docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) {
+ var file = path.match('.js$') ? path : path+'.js';
+ return grep('//@', file);
+});
+
+// Remove '//@'
+docs = docs.replace(/\/\/\@ ?/g, '');
+// Append docs to README
+sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
+
+echo('All done.');