#!/usr/bin/env node
'use strict';
+const Package = require('../package.json');
const Config = require('../config/config');
const Blog = require('..');
const Minimist = require('minimist');
const internals = {
blog: new Blog(Config),
- expectedKeys: ['add', 'update', 'publish'],
+ expectedKeys: ['add', 'generate', 'update', 'publish', 'publish-archive', 'version'],
// Application entry point. Reads arguments and calls the
// corresponding method from the blog lib
const value = parsedArguments[argument];
+ if (argument === 'version') {
+ console.log(Package.version);
+ return;
+ }
+
if (argument === 'add') {
await internals.blog.add(value);
return;
return;
}
+ if (argument === 'generate') {
+ await internals.blog.generate();
+ return;
+ }
+
if (argument === 'publish') {
- await internals.blog.update(value);
+ await internals.blog.publish(value);
+ return;
+ }
+
+ if (argument === 'publish-archive') {
+ await internals.blog.publishArchive(value);
return;
}
}
}
+
console.log('Not yet implemented');
}
catch (err) {
console.error('\nUsage:\n');
console.error('blog --add path/to/blog_post\t\t(creates new blog post)');
- console.error('blog --update path/to/blog_post\t(updates latest blog post)');
- console.error('blog --publish \t\t\t(publishes the blog)');
+ console.error('blog --update path/to/blog_post\t\t(updates latest blog post)');
+ console.error('blog --generate \t\t\t(generates the blog assets)');
+ console.error('blog --publish <bucket> \t\t(publishes the blog to an S3 bucket)');
+ console.error('blog --publish-archive <destination> \t(publishes the archive to a remote host)');
+ console.error('blog --version \t\t\t\t(print the version)');
}
};