Skip to content

update: Improve Cat utility with options, docs, and tests#3187

Merged
geekcomputers merged 1 commit into
geekcomputers:masterfrom
NitkarshChourasia:clean-cat-branch
Jun 27, 2026
Merged

update: Improve Cat utility with options, docs, and tests#3187
geekcomputers merged 1 commit into
geekcomputers:masterfrom
NitkarshChourasia:clean-cat-branch

Conversation

@NitkarshChourasia

Copy link
Copy Markdown
Contributor

Summary

Improves the Cat/cat.py program by making it closer to the Unix cat command and easier to test/use.

Changes

  • Reads files one at a time instead of loading all files into memory
  • Supports standard input when no file is provided
  • Supports - for reading from standard input between files
  • Prints file errors to stderr and continues processing remaining files
  • Adds proper exit codes
  • Adds command-line options:
    • -n / --number
    • -b / --number-nonblank
    • -s / --squeeze-blank
    • -E / --show-ends
  • Adds README.md with usage examples
  • Adds unittest test cases for the Cat program

Testing

Ran:

python -m unittest test_cat.py

@NitkarshChourasia

Copy link
Copy Markdown
Contributor Author

@geekcomputers Hello, please take a look at this pull request.
Thank you.

@NitkarshChourasia

Copy link
Copy Markdown
Contributor Author

@geekcomputers
@geekcomputers Hello, please take a look at this pull request.
Thank you.

@geekcomputers geekcomputers merged commit f06b489 into geekcomputers:master Jun 27, 2026
2 of 3 checks passed
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.

2 participants