Skip to content

Implement file copy CLI app#473

Open
S-Khraban wants to merge 1 commit intomate-academy:masterfrom
S-Khraban:develop
Open

Implement file copy CLI app#473
S-Khraban wants to merge 1 commit intomate-academy:masterfrom
S-Khraban:develop

Conversation

@S-Khraban
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work on the file copying application! Your solution is approved because it meets all the functional requirements, including argument parsing, path validation, and handling the copy operation correctly. While your use of console.error is correct, the error messages are generic. For future projects, consider making them more descriptive to improve usability, for example: Error: Invalid number of arguments. Usage: node app.js <source> <destination>. This helps users understand what went wrong. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

const args = process.argv.slice(2);

if (args.length !== 2) {
console.error('Error');

Choose a reason for hiding this comment

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

While this meets the requirement of using console.error, a more descriptive error message would be more helpful for the user. For instance, you could explain the correct usage, like Usage: node app.js <source> <destination>.

Comment on lines +22 to +25
if (!srcStat.isFile()) {
console.error('Error');
} else if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) {
console.error('Error');

Choose a reason for hiding this comment

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

It's great that you've added these checks for the source and destination paths. To make the tool more user-friendly, consider providing more specific error messages here instead of a generic 'Error'. For example, you could inform the user if the source is not a file or if the destination is a directory.

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