diff --git a/cmdline/Makefile b/cmdline/Makefile new file mode 100644 index 0000000..bc802ea --- /dev/null +++ b/cmdline/Makefile @@ -0,0 +1,3 @@ +test: + node cmdline.js --title 'super title' --mode ar --text 'I want a scene showing a text saying "Hi!".' --output examples/output.html + # node cmdline.js --title 'super title' --mode vr 'A sky at sunset' > examples/output.html diff --git a/cmdline/TODO.md b/cmdline/TODO.md new file mode 100644 index 0000000..f5051ec --- /dev/null +++ b/cmdline/TODO.md @@ -0,0 +1,12 @@ +# Issues +- make it work in AR + +# Have a good support of aframe-ar.js +- support ar.js options from the guri-xr + +# Idea with twitter and AR.js Augmented Website +- make it work with library like 3d.io +- with the twitter cards +- tweet 'i want a 3d.io furniture XXX in ar' and it replies the link with the twitter cards +- and you consume it directly on twitter +- it can be an iframe too that you put in any site diff --git a/cmdline/cmdline.js b/cmdline/cmdline.js new file mode 100644 index 0000000..bc1de81 --- /dev/null +++ b/cmdline/cmdline.js @@ -0,0 +1,40 @@ +var buildStory = require('../client/shared/story-builder') +var nlp = require('../client/shared/nlp') +var commandLineArgs = require('command-line-args') + +////////////////////////////////////////////////////////////////////////////// +// Code Separator +////////////////////////////////////////////////////////////////////////////// + +// Attempts at cmdline option parsing... +// - needs a -h --help +// - needs error message when error +// - i picked this package at random. aka it is the first i saw +// - may need a more knowledgable choise +var optionDefinitions = [ + { name: 'title', alias: 't', type: String }, + { name: 'mode', alias: 'm', type: String }, + { name: 'output', alias: 'o', type: String }, + { name: 'text', type: String }, +] + +var options = commandLineArgs(optionDefinitions) + +////////////////////////////////////////////////////////////////////////////// +// generate the html page +////////////////////////////////////////////////////////////////////////////// +var chapters = nlp(options.text) +var story = { + title: options.title, + chapters: chapters, + mode: options.mode +} +console.log(JSON.stringify(story, null, '\t')) +var html = buildStory(story) + +////////////////////////////////////////////////////////////////////////////// +// output html page +////////////////////////////////////////////////////////////////////////////// + +// dump the html into a file +require('fs').writeFileSync(options.output, html, 'utf8'); diff --git a/cmdline/examples/output.html b/cmdline/examples/output.html new file mode 100644 index 0000000..c18cfe9 --- /dev/null +++ b/cmdline/examples/output.html @@ -0,0 +1,166 @@ + + + +
+ + + + + + + + + + + +