mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 20:00:05 +01:00
grammar
This commit is contained in:
8
index.js
8
index.js
@@ -19,7 +19,7 @@ program
|
|||||||
.option('-op, --opions {object}', 'Options for the step')
|
.option('-op, --opions {object}', 'Options for the step')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
// Parse step into an array to allow for multiple step.
|
// Parse step into an array to allow for multiple steps.
|
||||||
program.step = program.step.split(" ");
|
program.step = program.step.split(" ");
|
||||||
|
|
||||||
// User must input an image.
|
// User must input an image.
|
||||||
@@ -30,7 +30,7 @@ require('fs').access(program.image, function(err){
|
|||||||
if(err) exit("Can't read file.")
|
if(err) exit("Can't read file.")
|
||||||
});
|
});
|
||||||
|
|
||||||
// User must input a step. If step exists, check that every step is a valid step.
|
// User must input a step. If steps exist, check that every step is a valid step.
|
||||||
if(!program.step || !program.step.every(function(step){return sequencer.modulesInfo().hasOwnProperty(step)}))
|
if(!program.step || !program.step.every(function(step){return sequencer.modulesInfo().hasOwnProperty(step)}))
|
||||||
exit("Please name a valid step.");
|
exit("Please name a valid step.");
|
||||||
|
|
||||||
@@ -60,14 +60,14 @@ sequencer.loadImages(program.image,function(){
|
|||||||
program.step.forEach(function(step){
|
program.step.forEach(function(step){
|
||||||
var options = Object.assign({}, sequencer.modulesInfo(step).inputs);
|
var options = Object.assign({}, sequencer.modulesInfo(step).inputs);
|
||||||
|
|
||||||
// If inputs exists, iterate through them and prompt for values.
|
// If inputs exist, iterate through them and prompt for values.
|
||||||
Object.keys(options).forEach(function(input) {
|
Object.keys(options).forEach(function(input) {
|
||||||
console.log(step + " : " + input + " : " + options[input].desc);
|
console.log(step + " : " + input + " : " + options[input].desc);
|
||||||
var value = readlineSync.question(step + " : " + "Enter a value for " + input + " : ");
|
var value = readlineSync.question(step + " : " + "Enter a value for " + input + " : ");
|
||||||
options[input] = value;
|
options[input] = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add the step and its options to the sequencer.
|
// Add the step and its inputs to the sequencer.
|
||||||
sequencer.addSteps(step, options);
|
sequencer.addSteps(step, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user