mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added ig repl banner...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cdd6689f22
commit
6655907afd
@ -38,8 +38,28 @@ var CLIActions = actions.Actions({
|
|||||||
config: {
|
config: {
|
||||||
// XXX do we care that something is not "ready" here???
|
// XXX do we care that something is not "ready" here???
|
||||||
'declare-ready-timeout': 0,
|
'declare-ready-timeout': 0,
|
||||||
|
|
||||||
|
banner: core.doc`$APPNAME $VERSION:`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// docs...
|
||||||
|
//
|
||||||
|
// XXX do a better set of examples...
|
||||||
|
cliExamples: [[
|
||||||
|
'Create/init index in current directory',
|
||||||
|
'$ $SCRIPTNAME init',
|
||||||
|
'',
|
||||||
|
'Export 500px previews from current index to ./preview directory',
|
||||||
|
'$ $SCRIPTNAME export from=. to=./previews --image-size=500',
|
||||||
|
]],
|
||||||
|
|
||||||
|
|
||||||
|
// the argvparser...
|
||||||
|
//
|
||||||
|
// this is set by argv's Parser on .onArgs(..) in .ready(..) handler below...
|
||||||
|
argv: undefined,
|
||||||
|
|
||||||
help: ['- System/Show action help',
|
help: ['- System/Show action help',
|
||||||
function(...actions){
|
function(...actions){
|
||||||
Object.entries(this.getDoc(actions))
|
Object.entries(this.getDoc(actions))
|
||||||
@ -196,16 +216,6 @@ var CLIActions = actions.Actions({
|
|||||||
]) }],
|
]) }],
|
||||||
|
|
||||||
|
|
||||||
// XXX do a better set of examples...
|
|
||||||
cliExamples: [[
|
|
||||||
'Create/init index in current directory',
|
|
||||||
'$ $SCRIPTNAME init',
|
|
||||||
'',
|
|
||||||
'Export 500px previews from current index to ./preview directory',
|
|
||||||
'$ $SCRIPTNAME export from=. to=./previews --image-size=500',
|
|
||||||
]],
|
|
||||||
|
|
||||||
|
|
||||||
// Startup commands...
|
// Startup commands...
|
||||||
//
|
//
|
||||||
cliStartREPL: ['- System/CLI/start CLI interpreter',
|
cliStartREPL: ['- System/CLI/start CLI interpreter',
|
||||||
@ -217,6 +227,7 @@ var CLIActions = actions.Actions({
|
|||||||
function(path, options){
|
function(path, options){
|
||||||
var that = this
|
var that = this
|
||||||
var repl = nodeRequire('repl')
|
var repl = nodeRequire('repl')
|
||||||
|
var package = nodeRequire('./package.json')
|
||||||
|
|
||||||
// XXX SETUP
|
// XXX SETUP
|
||||||
this.setupFeatures()
|
this.setupFeatures()
|
||||||
@ -230,30 +241,37 @@ var CLIActions = actions.Actions({
|
|||||||
global.ig =
|
global.ig =
|
||||||
global.ImageGrid =
|
global.ImageGrid =
|
||||||
this
|
this
|
||||||
|
|
||||||
global.help = function(...actions){
|
global.help = function(...actions){
|
||||||
global.ig.help(...actions) }
|
global.ig.help(...actions) }
|
||||||
|
//var features = global.ImageGridFeatures = core.ImageGridFeatures
|
||||||
var features = global.ImageGridFeatures = core.ImageGridFeatures
|
|
||||||
|
|
||||||
//var ig = core.ImageGridFeatures
|
|
||||||
|
|
||||||
// print banner...
|
// print banner...
|
||||||
//XXX
|
var banner = this.banner
|
||||||
|
|| this.config.banner
|
||||||
|
banner
|
||||||
|
&& process.stdin.isTTY
|
||||||
|
&& process.stdout.isTTY
|
||||||
|
&& console.log(banner
|
||||||
|
.replace(/\$APPNAME/g, package.name)
|
||||||
|
.replace(/\$AUTHOR/g, package.author)
|
||||||
|
.replace(/\$REPO/g, package.repository)
|
||||||
|
.replace(/\$SCRIPTNAME/g, this.argv.scriptName)
|
||||||
|
.replace(/\$VERSION/g, this.version))
|
||||||
|
|
||||||
|
// start the repl...
|
||||||
var code
|
var code
|
||||||
repl
|
repl
|
||||||
.start({
|
.start({
|
||||||
...(process.stdin.isTTY ?
|
...(process.stdin.isTTY ?
|
||||||
// interactive...
|
// interactive...
|
||||||
{
|
{ prompt: 'ig> ', }
|
||||||
prompt: 'ig> ',
|
|
||||||
}
|
|
||||||
// non-tty / non-interactive repl...
|
// non-tty / non-interactive repl...
|
||||||
|
// NOTE: this is handled by node's repl to avoid
|
||||||
|
// handling extra stuff here...
|
||||||
|
// XXX is this necessary???
|
||||||
: {
|
: {
|
||||||
terminal: false,
|
terminal: false,
|
||||||
prompt: '',
|
prompt: '',
|
||||||
// XXX HACK???
|
|
||||||
// collect the code...
|
// collect the code...
|
||||||
// NOTE: we are using a custom eval here as it
|
// NOTE: we are using a custom eval here as it
|
||||||
// seems that there is no way to either
|
// seems that there is no way to either
|
||||||
@ -273,7 +291,6 @@ var CLIActions = actions.Actions({
|
|||||||
//ignoreUndefined: true,
|
//ignoreUndefined: true,
|
||||||
})
|
})
|
||||||
.on('exit', function(){
|
.on('exit', function(){
|
||||||
// XXX HACK???
|
|
||||||
// run collected code...
|
// run collected code...
|
||||||
if(code){
|
if(code){
|
||||||
var AsyncFunction = (async function(){}).constructor
|
var AsyncFunction = (async function(){}).constructor
|
||||||
@ -756,6 +773,7 @@ module.CLI = core.ImageGridFeatures.Feature({
|
|||||||
// XXX SETUP need to setup everything that has command-line features...
|
// XXX SETUP need to setup everything that has command-line features...
|
||||||
//this.setupFeatures()
|
//this.setupFeatures()
|
||||||
|
|
||||||
|
// revise name...
|
||||||
argv.Parser({
|
argv.Parser({
|
||||||
context: this,
|
context: this,
|
||||||
|
|
||||||
@ -822,6 +840,8 @@ module.CLI = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
return res }, {}),
|
return res }, {}),
|
||||||
})
|
})
|
||||||
|
.onArgs(function(){
|
||||||
|
that.argv = this })
|
||||||
.onNoArgs(function(args){
|
.onNoArgs(function(args){
|
||||||
console.log('No args.')
|
console.log('No args.')
|
||||||
|
|
||||||
|
|||||||
4
Viewer/package-lock.json
generated
4
Viewer/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ImageGrid.Viewer.g4",
|
"name": "ImageGrid.Viewer.g4",
|
||||||
"version": "4.0.5a",
|
"version": "4.0.6a",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ImageGrid.Viewer.g4",
|
"name": "ImageGrid.Viewer.g4",
|
||||||
"version": "4.0.5a",
|
"version": "4.0.6a",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"app-module-path": "*",
|
"app-module-path": "*",
|
||||||
"async-json": "0.0.2",
|
"async-json": "0.0.2",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user