Barcelona|oct2025-2|Zhenishai Zhanybek|ModuleTools|Sprint4 - #7
Open
Jenishai5 wants to merge 7 commits into
Open
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 CLI tools: cat, ls, and wc
This PR introduces Python implementations of three classic Unix command-line tools: cat, ls, and wc. The goal was to replicate core functionality and behavior for specific use cases, following the project requirements.
Features
cat
Read and print file contents
Support multiple files and wildcard patterns (.txt)
-n flag: number all lines
-b flag: number only non-empty lines
Graceful handling of missing files
ls
List directory contents
-1 flag: display one item per line
-a flag: include hidden files
Support optional directory argument (defaults to current directory)
Sorted output for consistency
wc
Count lines, words, and characters
Support multiple files and wildcard patterns
Flags:
-l: lines only
-w: words only
-c: characters only
Displays totals when multiple files are provided
Implementation details
Used argparse for CLI argument parsing
Used glob to handle wildcard file patterns
Used os module for filesystem operations
Error handling implemented for missing files/directories
Output formatting aligned with expected Unix behavior
Tested commands
cat sample-files/1.txt
cat -n sample-files/.txt
cat -b sample-files/3.txt
ls -1
ls -1 sample-files
ls -1 -a sample-files
wc sample-files/*
wc -l sample-files/3.txt
wc -w sample-files/3.txt
wc -c sample-files/3.txt
wc -l sample-files/*