Added another feature-passing multiple dir paths #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As I mentioned on issue #13, I added a feature to pass multiple directory paths as an argument. To do that, first I made a new option which is called
-d
and--dir
and the type is array so that we can pass one or more dir. Now, we have two options which requires handling to make sure at least one option is passed. Hence, I made a function to check for options and do action according to the option they passed.The
-n
and-d
options will read file eventually as a result I moved yourfs.readFile
into a separate function called proceesFile. To read multiple directory, I used a for loop and calledfs.readdir
which will return all the files. Then, we need another for loop to go through each file and call the processFile function.To test my new feature, I made two new dir called test and test2 where each contains two files. The test is successful 🥳 Hope you like the features I added 😄. To be honest, I feel accomplished 🥰