Skip to content

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

Open
NitkarshChourasia wants to merge 1 commit into
geekcomputers:masterfrom
NitkarshChourasia:clean-cat-branch
Open

update: Improve Cat utility with options, docs, and tests#3187
NitkarshChourasia wants to merge 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

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.

1 participant