generate-docs.js 514 B

123456789101112131415161718192021
  1. #!/usr/bin/env node
  2. require('../global');
  3. echo('Appending docs to README.md');
  4. cd(__dirname + '/..');
  5. // Extract docs from shell.js
  6. var docs = grep('//@', 'shell.js');
  7. docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) {
  8. var file = path.match('.js$') ? path : path+'.js';
  9. return grep('//@', file);
  10. });
  11. // Remove '//@'
  12. docs = docs.replace(/\/\/\@ ?/g, '');
  13. // Append docs to README
  14. sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
  15. echo('All done.');