London | 26-Jul-SDC | Roman Sanaye | Sprint 3 | Implement Shell Tools#587
London | 26-Jul-SDC | Roman Sanaye | Sprint 3 | Implement Shell Tools#587RomanSanaye wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Hi Roman - solid grasp of the fundamentals here: your file reading and line/word/char counting all work, and the "total" loop in wc is nicely done. One structural thing is worth stepping back on, though, because it shapes the whole task. Right now there are ~17 scripts - roughly one per example command line - each with the flag and file path hard-coded inside it. When you run the real wc -l sample-files/3.txt, how does wc know both the flag and the file? Take a look at process.argv when you run node wc.js -l sample-files/3.txt - if your script read the flag and filename from there, how many of the README's command lines could a single wc.js handle?
My point is that once the arguments come in rather than being baked into each file, your 17 scripts collapse into three - one cat.js, one ls.js, one wc.js - each acting on whatever it's given. That's really the heart of the task. Could you have a go at rebuilding around argument handling and re-running each README command line against the real tool? Once that's in place I'll do a closer pass on the smaller details. The underlying skills are clearly there - keep going.
The result of the work should be three scripts: a single cat.js, a single ls.js and a single wc.js accepting command line parameters in the same manner as their real counterparts do.
Self checklist
Changelist
Implemented shell tools using Node.js.
Changes include:
wccommandfsmodule to read and process fileswccommandQuestions
No questions at the moment.