West Midlands | 26 March SDC | Iswat Bello | Sprint 4 | implement shell tools in python#505
Open
Iswanna wants to merge 3 commits intoCodeYourFuture:mainfrom
Open
Conversation
- Add .venv to ignore Python virtual environments - Add *.class to ignore Java compiled class files
- Implement ls/ls.py: Python version of ls utility - Add -1/--one-per-line flag for single column output - Add -a/--all flag to show hidden files (dotfiles) - Color directories in blue using ANSI escape codes - Sort entries case-insensitively for better readability - Support custom directory path argument (default to current directory) - Add error handling with proper exit codes - Match behavior of JavaScript implementation
- Implement wc/wc.py: Python version of wc utility - Support -l/--lines, -w/--words, -c/--bytes flags - Read from stdin when no files provided - Process multiple files with totals row - Calculate byte counts using raw file bytes for accuracy - Format output with right-justified columns (4-char width) - Handle file not found errors with proper exit codes - Match behavior of JavaScript implementation - Add argparse for robust CLI argument parsing
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.
Learners, PR Template
Self checklist
Changelist
In this PR, I implemented three core Unix shell utilities in Python:
cat,ls, andwc.cat/cat.py
-n/--numberflag: number all output lines-b/--number-nonblankflag: number only non-empty linesls/ls.py
-1/--one-per-lineflag: list one file per line-a/--allflag: show hidden files (dotfiles)wc/wc.py
-l/--linesflag: print line counts-w/--wordsflag: print word counts-c/--bytesflag: print byte counts