Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add command line script

  • Loading branch information...
commit 48852380731e06aa6c2787a0a86f0c0c2604d738 1 parent 6ebe92f
@vanetix authored
Showing with 53 additions and 0 deletions.
  1. +48 −0 bin/artificer
  2. +5 −0 index.js
View
48 bin/artificer
@@ -0,0 +1,48 @@
+#!/usr/bin/env node
+
+/**
+ * Script dependencies
+ */
+
+var artificer = require('../'),
+ utils = require('../lib/utils'),
+ package = require('../package'),
+ commander = require('commander');
+
+/**
+ * Commander options
+ */
+
+commander
+ .version(package.version)
+ .option('-s, --source [PATH]', 'source directory path - must be a directory', '')
+ .option('-d, --destination [PATH]', 'destination directory path - must not exist', '')
+ .option('-c, --config [NAME]', 'change the default name artificer uses for configuration files')
+ .option('-t, --title [NAME]', 'set the title on generated pages', '')
+ .parse(process.argv);
+
+/**
+ * Main script logic
+ */
+
+var src = commander.source,
+ dest = commander.destination;
+
+if(!src || !dest) {
+ commander.help();
+}
+
+if(!utils.exists(src) || utils.isFile(src)) {
+ process.stdout.write(' Source directory does not exist');
+ commander.help();
+}
+
+if(utils.exists(dest)) {
+ process.stdout.write(' Destination already exists on the filesystem');
+ commander.help();
+}
+
+artificer(src, dest, {
+ title: commander.title,
+ config: commander.config
+});
View
5 index.js
@@ -0,0 +1,5 @@
+/**
+ * Expose `artificer`
+ */
+
+module.exports = require('./lib/artificer');
Please sign in to comment.
Something went wrong with that request. Please try again.