mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
added better scripting support for ig repl...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cb6b45182f
commit
cdd6689f22
@ -241,9 +241,29 @@ var CLIActions = actions.Actions({
|
|||||||
// print banner...
|
// print banner...
|
||||||
//XXX
|
//XXX
|
||||||
|
|
||||||
|
var code
|
||||||
repl
|
repl
|
||||||
.start({
|
.start({
|
||||||
|
...(process.stdin.isTTY ?
|
||||||
|
// interactive...
|
||||||
|
{
|
||||||
prompt: 'ig> ',
|
prompt: 'ig> ',
|
||||||
|
}
|
||||||
|
// non-tty / non-interactive repl...
|
||||||
|
: {
|
||||||
|
terminal: false,
|
||||||
|
prompt: '',
|
||||||
|
// XXX HACK???
|
||||||
|
// collect the code...
|
||||||
|
// NOTE: we are using a custom eval here as it
|
||||||
|
// seems that there is no way to either
|
||||||
|
// disable the default writer or to define
|
||||||
|
// an alternative that would not output \n's
|
||||||
|
// per non-empty line of input...
|
||||||
|
eval: function(cmd, context, filename, callback) {
|
||||||
|
code = code ?? ''
|
||||||
|
code += cmd + '\n' }
|
||||||
|
}),
|
||||||
|
|
||||||
useGlobal: true,
|
useGlobal: true,
|
||||||
|
|
||||||
@ -253,6 +273,11 @@ var CLIActions = actions.Actions({
|
|||||||
//ignoreUndefined: true,
|
//ignoreUndefined: true,
|
||||||
})
|
})
|
||||||
.on('exit', function(){
|
.on('exit', function(){
|
||||||
|
// XXX HACK???
|
||||||
|
// run collected code...
|
||||||
|
if(code){
|
||||||
|
var AsyncFunction = (async function(){}).constructor
|
||||||
|
AsyncFunction(code)() }
|
||||||
that.stop() }) }],
|
that.stop() }) }],
|
||||||
// XXX move this to a feature that requires electron...
|
// XXX move this to a feature that requires electron...
|
||||||
// ...and move electron to an optional dependency...
|
// ...and move electron to an optional dependency...
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ImageGrid.Viewer.g4",
|
"name": "ImageGrid.Viewer.g4",
|
||||||
"main": "index.html",
|
"main": "index.html",
|
||||||
"version": "4.0.5a",
|
"version": "4.0.6a",
|
||||||
"author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)",
|
"author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)",
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
"repository": "github:flynx/ImageGrid",
|
"repository": "github:flynx/ImageGrid",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user