mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
574f4ff48e
commit
9c905603a9
@ -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('<action> [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,
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
|
||||
@ -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(<actions>, [<feature>, ...])
|
||||
// -> <actions>
|
||||
//
|
||||
// .setup([<feature>, ...])
|
||||
// -> <actions>
|
||||
//
|
||||
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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user