Skip to content

Conversation

@Pezhman-Azizi
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

This PR adds Python implementations of the three shell tools required for the sprint: cat, ls, and wc.
Each tool is implemented in its own commit for clarity and easier review.

This PR adds Python implementations of the three shell tools required for the sprint: cat, ls, and wc.
Each tool is implemented in its own commit for clarity and easier review.

🔹 What's Included

cat.py

  • Prints the contents of one or more files
  • Uses argparse
  • Matches basic behaviour of Unix cat

ls.py

  • Supports -1 (one entry per line)
  • Supports -a (show hidden files)
  • Uses os.listdir() and simple filtering

wc.py

  • Supports counting lines, words, and bytes
  • Implements flags -l, -w, -c
  • Supports multiple files and prints a total line
  • Uses argparse and UTF-8 byte counting

🔹 Notes

  • All tools behave as required in the sprint instructions
  • Each tool lives in its own folder (cat, ls, wc)
  • Each tool has its own clean commit for easier code review

@Pezhman-Azizi Pezhman-Azizi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 12, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 21, 2026
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start on this sprint's tasks, I have spotted a few areas where you could improve code further

Very nicely formatted PR text!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script works well, but you may want to take another look at the readme for this task, you seem to be missing some features

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good neat script!

if args.count_words:
totals_output.append(str(totals[1]))
if args.count_bytes:
totals_output.append(str(totals[2]))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you see the repetition in the structure of the output part of the script? can you think of any way to improve this?

output_parts.extend([str(lines), str(words), str(bytes_)])
else:
if args.count_lines:
output_parts.append(str(lines))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When multiple files are given, does the output look neat enough? is there any way you could improve how it looks?

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants