diff --git a/ui (gen4)/features/cli.js b/ui (gen4)/features/cli.js index 4037ca9c..a650baa2 100755 --- a/ui (gen4)/features/cli.js +++ b/ui (gen4)/features/cli.js @@ -38,25 +38,36 @@ module.CLI = core.ImageGridFeatures.Feature({ function(){ if(this.runtime == 'nw'){ var argv = requirejs('nw.gui').App.argv + + // XXX + console.log('>>>>', argv) + } else if(this.runtime == 'node'){ var argv = process.argv } - // XXX for some reason this always contains --help in nw... - //console.log('>>>>', argv) var cli = requirejs('commander') + cli .version('0.0.1') - .usage('[command] [options] ..') - .option('--features', 'list loaded features') - .command('index [path]', 'build and index of path') + //.usage('[command] [options] ..') + + .option('--list-features', 'list loaded features') + + //.command('index [path]', 'build an index of path') + + .arguments(' [args]') + .action(function(action, args){ + console.log('>>>>', action, args) + }) + .parse(argv) // list features... - // XXX make this a core action... - if(cli.features){ + // XXX make this a core action... (???) + if(cli.listFeatures){ this.features.excluded.length > 0 && console.warn('Features excluded (%d):\n ', this.features.excluded.length, diff --git a/ui (gen4)/ig.js b/ui (gen4)/ig.js index 02299a98..8e98f381 100644 --- a/ui (gen4)/ig.js +++ b/ui (gen4)/ig.js @@ -46,12 +46,9 @@ module.ImageGridFeatures = //--------------------------------------------------------------------- -// XXX stub action set -- this needs to be auto-generated... -var a = actions.Actions() - -// setup actions... +// setup actions and start... ImageGridFeatures - .setup(a, ['viewer-commandline']) + .setup(['viewer-commandline']) .start() diff --git a/ui (gen4)/lib/features.js b/ui (gen4)/lib/features.js index d347d11e..514740b3 100755 --- a/ui (gen4)/lib/features.js +++ b/ui (gen4)/lib/features.js @@ -9,6 +9,7 @@ define(function(require){ var module = {} //var DEBUG = DEBUG != null ? DEBUG : true args2array = require('lib/util').args2array + actions = require('lib/actions') @@ -519,7 +520,21 @@ module.FeatureSet = { } }, + // + // .setup(, [, ...]) + // -> + // + // .setup([, ...]) + // -> + // setup: function(obj, lst){ + // if no explicit object is given, just the list... + if(lst == null){ + lst = obj + obj = null + } + + obj = obj || actions.Actions() lst = lst.constructor !== Array ? [lst] : lst var features = this.buildFeatureList(obj, lst) lst = features.features diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 9149db93..5eeead2a 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -262,15 +262,10 @@ $(function(){ m = Object.keys(m).filter(function(e){ return m[e] != null }) console.log('Modules (%d):', m.length, m) - // XXX stub action set -- this needs to be auto-generated... - window.a = actions.Actions() - - // used switch experimental actions on (set to true) or off (unset or false)... - //a.experimental = true // setup actions... - viewer.ImageGridFeatures - .setup(a, [ + window.a = viewer.ImageGridFeatures + .setup([ 'viewer-testing', // XXX this is not for production... @@ -278,6 +273,10 @@ $(function(){ ]) + // used switch experimental actions on (set to true) or off (unset or false)... + //a.experimental = true + + // report stuff... // XXX we also have .conflicts and .missing a.features.excluded.length > 0