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

@ -4,22 +4,15 @@ const {
getChallengeSeed,
padWithLeadingZeros,
getExistingStepNums,
getProjectPath
getProjectPath,
getArgValues
} = require('./utils');
const allStepsExist = (steps, stepsToFind) =>
stepsToFind.every(num => steps.includes(num));
const projectPath = getProjectPath();
const argValuePairs = process.argv.slice(2);
const args = argValuePairs.reduce((argsObj, arg) => {
const [argument, value] = arg.replace(/\s/g, '').split('=');
if (!argument || !value) {
throw `Invalid argument/value specified: ${arg}`;
}
return { ...argsObj, [argument]: value };
}, {});
const args = getArgValues(process.argv);
let { start, end } = args;
start = parseInt(start, 10);