resolves #131 create output directory immediately (#167)

* resolves #131 create output directory immediately

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* fix error if no steps are passed

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* add exit message if steps not passed

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* add test for creating output directory
This commit is contained in:
Varun Gupta
2018-02-07 03:12:22 +05:30
committed by Jeffrey Warren
parent c5dee8aef3
commit 32c5a29906
5 changed files with 45 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ program
.parse(process.argv);
// Parse step into an array to allow for multiple steps.
if(!program.step) exit("No steps passed")
program.step = program.step.split(" ");
// User must input an image.
@@ -58,7 +59,11 @@ sequencer.setUI({
sequencer.loadImages(program.image,function(){
console.warn('\x1b[33m%s\x1b[0m', "The execution will be async\nYou may not see the output for a few seconds or minutes")
if(program.basic) console.log("Basic mode is enabled, outputting only final image")
//Generate the Output Directory
require('./src/CliUtils').makedir(program.output,()=>{
console.log("Files will be exported to \""+program.output+"\"");
if(program.basic) console.log("Basic mode is enabled, outputting only final image")
// Iterate through the steps and retrieve their inputs.
program.step.forEach(function(step){
@@ -92,14 +97,15 @@ sequencer.loadImages(program.image,function(){
// Export all images or final image as binary files.
sequencer.exportBin(program.output,program.basic);
console.log("Files will be exported to \""+program.output+"\"");
});
});
});
// Takes an array of steps and checks if they are valid steps for the sequencer.
function validateSteps(steps) {
function validateSteps(steps) {
// Assume all are valid in the beginning.
var valid = true;