Anastasiia Hlushkova | Oct2025-1 | Module-Tools | Sprint-4 | Implement-shell-tools-in-Python - #7
Anastasiia Hlushkova | Oct2025-1 | Module-Tools | Sprint-4 | Implement-shell-tools-in-Python#7ksbn wants to merge 5 commits into
Conversation
|
|
||
| parser = argparse.ArgumentParser(prog='ls') | ||
| parser.add_argument('directory', nargs='?', default='.') | ||
| parser.add_argument('-1', action='store_true', dest='one') |
There was a problem hiding this comment.
It doesn't look like this argument is used.
|
Overall looks good. Just a point on the Even though these are relatively small scripts, I think it's a good exercise to think about how you might go about writing tests for these. In a professional context you'd want to have a test suite so that if you were to continue expanding these tools with support for additional options, then you can ensure that you don't break existing behaviour as the complexity increases. That's something I can help you with if you're interested, or I could write up an example of how I would go about testing it. |
Thank you for the feedback! I will fix the unused I'm still in my learning journey so seeing a real example of how you'd approach testing these tools would be really valuable. |
Implement shell tools in Python
This PR implements the following shell tools in Python:
cat-nflag: numbers all lines, resetting per file-bflag: numbers non-empty lines onlyls-1flag: lists files one per line-aflag: includes hidden files and./..entrieswc-lflag: line count-wflag: word count-cflag: byte countAll tools match the output and formatting of their real shell equivalents.