playing with cli handling structure...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-01-02 23:27:50 +03:00
parent d7eebd9719
commit fda89e53c0

View File

@ -69,22 +69,9 @@ module.CLI = core.ImageGridFeatures.Feature({
.version('0.0.1')
//.usage('[command] [options] ..')
.option('--list-features', 'list loaded features')
//.command('index [path]', 'build an index of path')
.arguments('<action> [args]')
.action(function(action, args){
// XXX
console.log('>>>>', action, args)
})
.parse(argv)
// list features...
// XXX make this a core action... (???)
if(cli.listFeatures){
.option('--list-features', 'list loaded features', function(){
// excluded...
this.features.excluded.length > 0
&& console.warn('Features excluded (%d):\n ',
@ -100,7 +87,26 @@ module.CLI = core.ImageGridFeatures.Feature({
console.log('Features loaded (%d):\n ',
this.features.features.length,
this.features.features.join('\n '))
}
})
// list actions...
// XXX this is a bit pointless as single actions are
// meaningless when no state is stored...
.option('--list-actions', 'list loaded actions', function(){
console.log('Actions loaded (%d):\n ',
this.length,
Object.keys(this.getDoc()).join('\n '))
})
//.command('index [path]', 'build an index of path')
.arguments('<action> [args]')
.action(function(action, args){
// XXX
console.log('>>>>', action, args)
})
.parse(argv)
}]
],
})