-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes error on |
character in CLI
#1634
base: main
Are you sure you want to change the base?
Changes from 2 commits
3678381
3e77d6b
85e9503
e2bf7d9
ea263ab
697eedc
3adf567
fff6dcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,44 +9,31 @@ module.exports = function (program, sequencer, outputFilename) { | |
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) { | ||
var options = Object.assign({}, sequencer.modulesInfo(step).inputs); | ||
|
||
program.steps.forEach(function(step) { | ||
var options = Object.assign({}, sequencer.modulesInfo(step.name).inputs); | ||
|
||
// If inputs exists, print to console. | ||
if (Object.keys(options).length) { | ||
console.log('[' + step + ']: Inputs'); | ||
console.log('[' + step.name + ']: Inputs'); | ||
} | ||
|
||
// If inputs exists, print them out with descriptions. | ||
Object.keys(options).forEach(function(input) { | ||
// The array below creates a variable number of spaces. This is done with (length + 1). | ||
// The extra 4 that makes it (length + 5) is to account for the []: characters | ||
console.log( | ||
new Array(step.length + 5).join(' ') + | ||
new Array(step.name.length + 5).join(' ') + | ||
input + | ||
': ' + | ||
options[input].desc | ||
); | ||
}); | ||
|
||
if (program.config) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was this and why was it removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was used to get input for options for different modules using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we can't directly give input? Or is there a different flag for it now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah just need clarification on this - thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before: So since we used to give options seperately therefore we needed the |
||
try { | ||
var config = JSON.parse(program.config); | ||
console.log('The parsed options object: ', config); | ||
} catch (e) { | ||
console.error( | ||
'\x1b[31m%s\x1b[0m', | ||
'Options(Config) is not a not valid JSON Fallback activate' | ||
); | ||
program.config = false; | ||
console.log(e); | ||
} | ||
} | ||
if (program.config && utils.validateConfig(config, options)) { | ||
if (Object.keys(step.options).length > 0) { | ||
console.log('Now using Options object'); | ||
Object.keys(options).forEach(function(input) { | ||
options[input] = config[input]; | ||
options[input] = step.options[input]; | ||
}); | ||
} else { | ||
// If inputs exist, iterate through them and prompt for values. | ||
|
@@ -66,7 +53,7 @@ module.exports = function (program, sequencer, outputFilename) { | |
}); | ||
} | ||
// Add the step and its inputs to the sequencer. | ||
sequencer.addSteps(step, options); | ||
sequencer.addSteps(step.name, options); | ||
}); | ||
|
||
var spinnerObj = { succeed: () => { }, stop: () => { } }; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use array
map
function.stepNames = program.step.split(',').map(....)
.Let's make the code concise and modern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea you're right, I will do that ASAP!