Barcelona|oct2025-02|Zhenishai Zhanybek|Sprint-3|Module-Tools|ImplementShellTools - #6
Open
Jenishai5 wants to merge 2 commits into
Open
Barcelona|oct2025-02|Zhenishai Zhanybek|Sprint-3|Module-Tools|ImplementShellTools#6Jenishai5 wants to merge 2 commits into
Jenishai5 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implement Shell Tools: cat, ls, wc
This PR includes implementations of three classic Unix command-line tools: cat, ls, and wc, built using Node.js.
cat
Supports reading and printing file contents
Implemented flags:
-n → numbers all lines
-b → numbers only non-empty lines
Supports multiple files (*.txt)
Line numbering continues across multiple files (like real cat)
ls
Lists directory contents
Implemented flags:
-1 → one entry per line
-a → includes hidden files
wc
Counts lines, words, and bytes
Implemented flags:
-l → lines
-w → words
-c → bytes
Supports multiple files and outputs total counts
Default behavior shows all three metrics
Approach
I implemented each tool incrementally:
Basic functionality for a single file/directory
Support for multiple inputs
Added flags and edge case handling
Notes
Focused on matching expected behavior for the specified commands
Some advanced features of the original Unix tools are not included (stretch goals)
This exercise helped me better understand:
Working with the file system in Node.js
Parsing CLI arguments
Handling edge cases like empty lines and hidden files
How real shell tools behave under the hood