]> git.r.bdr.sh - rbdr/blog/blobdiff - bin/blog.js
Add rudimentary sync support
[rbdr/blog] / bin / blog.js
index 3c37f47a9b06046b77512ae177fde3719f732c2a..dc256ee7d05021ae2c4266ed322f6dc1e51c3b6f 100755 (executable)
@@ -8,7 +8,17 @@ const Minimist = require('minimist');
 
 const internals = {
   blog: new Blog(Config),
-  expectedKeys: ['add',  'generate', 'update', 'publish', 'version'],
+  expectedKeys: [
+    'add',
+    'generate',
+    'update',
+    'publish',
+    'publish-archive',
+    'add-remote',
+    'remove-remote',
+    'sync-up',
+    'sync-down',
+    'version'],
 
   // Application entry point. Reads arguments and calls the
   // corresponding method from the blog lib
@@ -47,6 +57,31 @@ const internals = {
             await internals.blog.publish(value);
             return;
           }
+
+          if (argument === 'publish-archive') {
+            await internals.blog.publishArchive(value);
+            return;
+          }
+
+          if (argument === 'add-remote') {
+            await internals.blog.addRemote(value);
+            return;
+          }
+
+          if (argument === 'remove-remote') {
+            await internals.blog.removeRemote();
+            return;
+          }
+
+          if (argument === 'sync-up') {
+            await internals.blog.syncUp();
+            return;
+          }
+
+          if (argument === 'sync-down') {
+            await internals.blog.syncDown();
+            return;
+          }
         }
       }
 
@@ -89,7 +124,12 @@ const internals = {
     console.error('blog --add path/to/blog_post\t\t(creates new blog post)');
     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\t\t(publishes the blog to an S3 bucket)');
+    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 --add-remote <git_url> \t\t(adds or updates a git remote to sync with)');
+    console.error('blog --remove-remote \t\t\t(removes the git remote)');
+    console.error('blog --sync-up \t\t\t\t(pushes to the git remote if configured)');
+    console.error('blog --sync-down \t\t\t(pulls from the git remote if configured)');
     console.error('blog --version \t\t\t\t(print the version)');
   }
 };