1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- const chalk = require('chalk');
- var fetch_projects = require('./fetch-scripts/fetch-projects');
- var hasArg = function(arg){
- for (let i = 0; i < process.argv.length; i++) {
- if (arg == process.argv[i]) return true;
- }
- return false;
- }
- var isVerbose = function(){
- if(hasArg('-v') || hasArg('--verbose')) return true;
- else return false;
- }
- if(hasArg('help') || hasArg('-h')) {
- console.log();
- console.log('Usage: ' + chalk.bgWhite.black('node fetch-content <command>'));
- console.log();
- console.log('Copy files from codex to build the website content.');
- console.log();
- console.log(chalk.bold(' Command Description'));
- console.log(' projects Copy projects from Codex');
- console.log(' posts Copy blog posts from Codex');
- console.log(' -v, --verbose Log all output');
- console.log();
- console.log();
- return;
- }
- if(hasArg('projects')) {
- if(isVerbose()) console.log('Copying projects from Codex');
- fetch_projects();
- return;
- }
- if(hasArg('posts')) {
- if(isVerbose()) console.log('Copying blog posts from Codex');
- return;
- }
- if(isVerbose()) console.log('Copying projects and blog posts from Codex');
- fetch_projects();
|