mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
more tweaking of cli...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0f10178948
commit
e020cc64e1
@ -280,8 +280,6 @@ var CLIActions = actions.Actions({
|
|||||||
{cli: argv && argv.Parser({
|
{cli: argv && argv.Parser({
|
||||||
key: '@export',
|
key: '@export',
|
||||||
|
|
||||||
//usage: '$SCRIPTNAME to=PATH [OPTIONS]',
|
|
||||||
|
|
||||||
// help...
|
// help...
|
||||||
'-help-pattern': {
|
'-help-pattern': {
|
||||||
doc: 'Show image filename pattern info and exit',
|
doc: 'Show image filename pattern info and exit',
|
||||||
@ -296,39 +294,51 @@ var CLIActions = actions.Actions({
|
|||||||
'@from': {
|
'@from': {
|
||||||
doc: 'Source path',
|
doc: 'Source path',
|
||||||
arg: 'PATH | from',
|
arg: 'PATH | from',
|
||||||
default: '.', },
|
default: '.',
|
||||||
|
valueRequired: true, },
|
||||||
'@to': {
|
'@to': {
|
||||||
doc: 'Destination path',
|
doc: 'Destination path',
|
||||||
arg: 'PATH | path',
|
arg: 'PATH | path',
|
||||||
required: true,
|
required: true,
|
||||||
valueRequired: true, },
|
valueRequired: true, },
|
||||||
|
|
||||||
// options...
|
// bool options...
|
||||||
// XXX these should get defaults from .config
|
// XXX these should get defaults from .config
|
||||||
'-include-virtual': {
|
'-include-virtual': {
|
||||||
doc: 'Include virtual blocks',
|
doc: 'Include virtual blocks',
|
||||||
arg: 'BOOL | include-virtual',
|
arg: '| include-virtual',
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
|
value: true,
|
||||||
default: true, },
|
default: true, },
|
||||||
'-clean-target': {
|
'-clean-target': {
|
||||||
doc: 'Cleanup target before export (backup)',
|
doc: 'Cleanup target before export (backup)',
|
||||||
arg: 'BOOL | clean-target',
|
arg: '| clean-target',
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
|
value: true,
|
||||||
default: true, },
|
default: true, },
|
||||||
|
'-no-*': {
|
||||||
|
doc: 'Negate boolean option value',
|
||||||
|
handler: function(rest, key, value, ...args){
|
||||||
|
rest.unshift(key.replace(/^-?-no/, '') +'=false') } },
|
||||||
|
|
||||||
|
// options...
|
||||||
'-image-name': {
|
'-image-name': {
|
||||||
doc: 'Image name pattern',
|
doc: 'Image name pattern',
|
||||||
arg: 'PATTERN | preview-name-pattern',
|
arg: 'PATTERN | preview-name-pattern',
|
||||||
default: '%(fav)l%n%(-%c)c', },
|
default: '%(fav)l%n%(-%c)c',
|
||||||
|
valueRequired: true, },
|
||||||
// XXX get values automatically...
|
// XXX get values automatically...
|
||||||
'-mode': {
|
'-mode': {
|
||||||
doc: 'Export mode, can be "resize" or "copy best match"',
|
doc: 'Export mode, can be "resize" or "copy best match"',
|
||||||
arg: 'MODE | export-mode',
|
arg: 'MODE | export-mode',
|
||||||
//default: 'copy best match',
|
//default: 'copy best match',
|
||||||
default: 'resize', },
|
default: 'resize',
|
||||||
|
valueRequired: true, },
|
||||||
'-image-size': {
|
'-image-size': {
|
||||||
doc: 'Output image size',
|
doc: 'Output image size',
|
||||||
arg: 'SIZE | preview-size',
|
arg: 'SIZE | preview-size',
|
||||||
default: 1000, },
|
default: 1000,
|
||||||
|
valueRequired: true, },
|
||||||
})},
|
})},
|
||||||
function(path, options={}){
|
function(path, options={}){
|
||||||
var that = this
|
var that = this
|
||||||
@ -343,7 +353,6 @@ var CLIActions = actions.Actions({
|
|||||||
.then(
|
.then(
|
||||||
function(){
|
function(){
|
||||||
return that.exportImages(options) },
|
return that.exportImages(options) },
|
||||||
// XXX for some reason we still get an error up the call stack...
|
|
||||||
function(err){
|
function(err){
|
||||||
console.error('Can\'t find or load index at:', path) }) }],
|
console.error('Can\'t find or load index at:', path) }) }],
|
||||||
|
|
||||||
|
|||||||
@ -262,43 +262,35 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
// NOTE: when passed no path this will not do anything...
|
// NOTE: when passed no path this will not do anything...
|
||||||
// NOTE: this will add a .from field to .location, this will indicate
|
// NOTE: this will add a .from field to .location, this will indicate
|
||||||
// the date starting from which saves are loaded.
|
// the date starting from which saves are loaded.
|
||||||
//
|
|
||||||
// XXX look inside...
|
|
||||||
loadIndex: ['- File/Load index',
|
loadIndex: ['- File/Load index',
|
||||||
function(path, from_date, logger){
|
function(path, from_date, logger){
|
||||||
var that = this
|
var that = this
|
||||||
var index_dir = util.normalizePath(this.config['index-dir'])
|
var index_dir = util.normalizePath(this.config['index-dir'])
|
||||||
// XXX get a logger...
|
|
||||||
logger = logger || this.logger
|
logger = logger || this.logger
|
||||||
logger = logger && logger.push('Load')
|
logger = logger && logger.push('Load')
|
||||||
|
|
||||||
if(path == null){
|
if(path == null){
|
||||||
return
|
logger && logger.emit('error: no path given')
|
||||||
}
|
return Promise.reject('no path given') }
|
||||||
path = util.normalizePath(path)
|
path = util.normalizePath(path)
|
||||||
|
|
||||||
if(from_date && from_date.emit != null){
|
if(from_date && from_date.emit != null){
|
||||||
logger = from_date
|
logger = from_date
|
||||||
from_date = null }
|
from_date = null }
|
||||||
|
|
||||||
// XXX make this load incrementally (i.e. and EventEmitter
|
|
||||||
// a-la glob)....
|
|
||||||
//file.loadIndex(path, this.config['index-dir'], logger)
|
|
||||||
return file.loadIndex(path, index_dir, from_date, logger)
|
return file.loadIndex(path, index_dir, from_date, logger)
|
||||||
.then(function(res){
|
.then(function(res){
|
||||||
var force_full_save = false
|
var force_full_save = false
|
||||||
|
|
||||||
// skip nested paths...
|
// skip nested paths...
|
||||||
//
|
|
||||||
// XXX make this optional...
|
// XXX make this optional...
|
||||||
// XXX this is best done BEFORE we load all the
|
|
||||||
// indexes, e.g. in .loadIndex(..)
|
|
||||||
var skipped = new Set()
|
var skipped = new Set()
|
||||||
var paths = Object.keys(res)
|
var paths = Object.keys(res)
|
||||||
// no indexes found...
|
// no indexes found...
|
||||||
if(paths.length == 0){
|
if(paths.length == 0){
|
||||||
logger && logger.emit('error: no index at', path)
|
logger && logger.emit('error: no index in', path)
|
||||||
return Promise.reject('no index at: '+ path) }
|
return Promise.reject('no index in: '+ path) }
|
||||||
paths
|
paths
|
||||||
.forEach(function(p){
|
.forEach(function(p){
|
||||||
// already removed...
|
// already removed...
|
||||||
@ -364,11 +356,9 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
|
|
||||||
// merge...
|
// merge...
|
||||||
index.data.join(part.data)
|
index.data.join(part.data)
|
||||||
index.images.join(part.images)
|
index.images.join(part.images) }
|
||||||
}
|
|
||||||
|
|
||||||
loaded.push(k)
|
loaded.push(k) }
|
||||||
}
|
|
||||||
|
|
||||||
logger && logger.emit('load index', index)
|
logger && logger.emit('load index', index)
|
||||||
|
|
||||||
@ -553,9 +543,7 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
}) }
|
}) }
|
||||||
|
|
||||||
// pass on the result...
|
// pass on the result...
|
||||||
resolve(imgs)
|
resolve(imgs) }) })
|
||||||
})
|
|
||||||
})
|
|
||||||
// load previews if they exist...
|
// load previews if they exist...
|
||||||
.then(function(imgs){
|
.then(function(imgs){
|
||||||
var index_dir = that.config['index-dir']
|
var index_dir = that.config['index-dir']
|
||||||
@ -997,34 +985,41 @@ module.FileSystemLoader = core.ImageGridFeatures.Feature({
|
|||||||
['loadImages',
|
['loadImages',
|
||||||
function(res){
|
function(res){
|
||||||
var that = this
|
var that = this
|
||||||
res.then(function(){
|
res.then(
|
||||||
that.markChanged('all') }) }],
|
function(){
|
||||||
|
that.markChanged('all') },
|
||||||
|
function(){}) }],
|
||||||
// add new images to changes...
|
// add new images to changes...
|
||||||
['loadNewImages',
|
['loadNewImages',
|
||||||
function(res){
|
function(res){
|
||||||
var that = this
|
var that = this
|
||||||
res.then(function(imgs){
|
res.then(
|
||||||
|
function(imgs){
|
||||||
imgs
|
imgs
|
||||||
&& imgs.length > 0
|
&& imgs.length > 0
|
||||||
&& that
|
&& that
|
||||||
.markChanged('data')
|
.markChanged('data')
|
||||||
.markChanged('images', imgs.keys()) })
|
.markChanged('images', imgs.keys()) },
|
||||||
}],
|
function(){}) }],
|
||||||
['checkIndex',
|
['checkIndex',
|
||||||
function(res){
|
function(res){
|
||||||
var that = this
|
var that = this
|
||||||
res.then(function(gids){
|
res.then(
|
||||||
|
function(gids){
|
||||||
gids.length > 0
|
gids.length > 0
|
||||||
&& that.markChanged('images', gids) }) }],
|
&& that.markChanged('images', gids) },
|
||||||
|
function(){}) }],
|
||||||
['removeMissingImages',
|
['removeMissingImages',
|
||||||
function(res){
|
function(res){
|
||||||
var that = this
|
var that = this
|
||||||
res.then(function(gids){
|
res.then(
|
||||||
|
function(gids){
|
||||||
gids.length > 0
|
gids.length > 0
|
||||||
&& that
|
&& that
|
||||||
.markChanged('data')
|
.markChanged('data')
|
||||||
.markChanged('images')
|
.markChanged('images')
|
||||||
.reload(true) }) }],
|
.reload(true) },
|
||||||
|
function(){}) }],
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
14
Viewer/package-lock.json
generated
14
Viewer/package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ImageGrid.Viewer.g4",
|
"name": "ImageGrid.Viewer.g4",
|
||||||
"version": "4.0.0a",
|
"version": "4.0.0-a",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -1124,9 +1124,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ig-argv": {
|
"ig-argv": {
|
||||||
"version": "2.15.7",
|
"version": "2.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/ig-argv/-/ig-argv-2.15.7.tgz",
|
"resolved": "https://registry.npmjs.org/ig-argv/-/ig-argv-2.16.0.tgz",
|
||||||
"integrity": "sha512-o5SpXe6r/mv8TuwMiOr3EmQz2bVmCQ2h9bd4hM9rIJN3LtPh8mtprqC30Yc/+JMtaRH0nkdblGlZKbOJz00wBA==",
|
"integrity": "sha512-lWgUthK4CBpYJlaFaRmfaCVlZW4u4n/9QZAcTnutDAe5wT5UJ6nD+X/OJLgqU1suLP2H5OThGJtdDBNqwEPGOA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ig-object": "^5.2.6"
|
"ig-object": "^5.2.6"
|
||||||
}
|
}
|
||||||
@ -1183,9 +1183,9 @@
|
|||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz",
|
||||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
|
"integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ=="
|
||||||
},
|
},
|
||||||
"is-arrayish": {
|
"is-arrayish": {
|
||||||
"version": "0.3.2",
|
"version": "0.3.2",
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"guarantee-events": "^1.0.0",
|
"guarantee-events": "^1.0.0",
|
||||||
"ig-actions": "^3.24.22",
|
"ig-actions": "^3.24.22",
|
||||||
"ig-argv": "^2.15.7",
|
"ig-argv": "^2.16.0",
|
||||||
"ig-features": "^3.4.2",
|
"ig-features": "^3.4.2",
|
||||||
"ig-object": "^5.4.12",
|
"ig-object": "^5.4.12",
|
||||||
"ig-types": "^5.0.40",
|
"ig-types": "^5.0.40",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user