Commits

Alessio Caiazza  committed f16bc47

commander

  • Participants
  • Parent commits d11e6ca
  • Branches develop

Comments (0)

Files changed (5)

File bin/obsidian-tales

+#!/usr/bin/env node
+var main = require('../lib/main');
+
+main(process.argv);
+var program = require('commander');
+var version = require('./version');
+
+function main(argv) {
+  program
+    .version(version())
+    .option('-p, --peppers', 'Add peppers')
+    .option('-P, --pineapple', 'Add pineapple')
+    .option('-b, --bbq', 'Add bbq sauce')
+    .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+    .parse(argv);
+
+  console.log('you ordered a pizza with:');
+  if (program.peppers) console.log('  - peppers');
+  if (program.pineapple) console.log('  - pineappe');
+  if (program.bbq) console.log('  - bbq');
+  console.log('  - %s cheese', program.cheese);
+}
+
+module.exports = main;

File lib/version.js

+function obsidiantales_version() {
+  return "0.0.1";
+}
+
+module.exports = obsidiantales_version;

File package.json

   "version": "0.0.1",
   "description": "ObsidianTales allows you to made a static version of your Obsidian Portal campaigns",
   "main": "lib/main.js",
+  "bin": { "obsidian-tales": "./bin/obsidian-tales" },
   "directories": {
     "test": "test"
   },

File test/main.js

+var should = require('should');
+var sleepsort = require('../lib/main');
+
+describe('sleepsort', function() {
+  describe('with no arguments', function() {
+    it('returns an empty array', function() {
+      var result = sleepsort();
+      result.should.eql([]);
+    });
+  });
+});