Skip to content
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

Added another feature-passing multiple dir paths #14

Merged
merged 3 commits into from
Oct 2, 2020

Conversation

sanji11
Copy link

@sanji11 sanji11 commented Oct 2, 2020

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 your fs.readFile into a separate function called proceesFile. To read multiple directory, I used a for loop and called fs.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 🥰

@Supercraft888
Copy link
Owner

Thanks again! Your awesome!

@Supercraft888 Supercraft888 merged commit 36d4f12 into Supercraft888:master Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants