feat(learn): Create tool to delete an existing project step in project-based curriculum (#39786)

* feat: created tool to delete step

* docs: update README.md with delete-step instructions

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Randell Dawson
2020-10-03 02:54:19 -07:00
committed by GitHub
parent 86a1da59ff
commit 90f6d23639
6 changed files with 66 additions and 22 deletions

View File

@ -201,11 +201,22 @@ const getExistingStepNums = projectPath => {
const getProjectPath = () =>
(process.env.CALLING_DIR || process.cwd()) + path.sep;
const getArgValues = argv => {
return argv.slice(2).reduce((argsObj, arg) => {
const [argument, value] = arg.replace(/\s/g, '').split('=');
if (!argument || !value) {
throw `Invalid argument/value specified: ${arg}`;
}
return { ...argsObj, [argument]: value };
}, {});
};
module.exports = {
createStepFile,
getChallengeSeed,
padWithLeadingZeros,
reorderSteps,
getExistingStepNums,
getProjectPath
getProjectPath,
getArgValues
};