Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Add cat_xlsx command with usage information #6

Merged
merged 5 commits into from
Nov 30, 2024

Conversation

sangshuduo
Copy link
Owner

  • Add cat_xlsx command to the CLI tool
  • Display usage information for cat_xlsx command
  • Implement options for cat_xlsx command: -h, --help and -V, --version
  • Update dependencies in Cargo.toml: clap to version 4.1 with derive feature, and calamine to version 0.26.1
  • Refactor main.rs to use clap for command-line argument parsing
  • Implement Args struct with xlsx_file field for parsing command-line arguments
  • Check if the provided xlsx file exists before processing
  • Improve error handling in main function
  • Iterate over worksheets and print cells' data in cat_xlsx command

- Add cat_xlsx command to the CLI tool
- Display usage information for cat_xlsx command
- Implement options for cat_xlsx command: `-h, --help` and `-V, --version`
- Update dependencies in Cargo.toml: `clap` to version 4.1 with `derive` feature, and `calamine` to version 0.26.1
- Refactor main.rs to use clap for command-line argument parsing
- Implement Args struct with xlsx_file field for parsing command-line arguments
- Check if the provided xlsx file exists before processing
- Improve error handling in main function
- Iterate over worksheets and print cells' data in cat_xlsx command
Copy link
Contributor

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

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

The PR introduces a solid foundation for the cat_xlsx command. The code is well-structured and uses modern Rust practices with clap for argument parsing. However, it could benefit from more robust error handling and user feedback. Consider adding configuration options for output format in future iterations, and adding tests to ensure reliability. The README provides basic usage information but could be enhanced with examples of the output format and more detailed usage scenarios.

Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!

sangshuduo and others added 4 commits November 30, 2024 00:49
Co-authored-by: mentatbot[bot] <160964065+mentatbot[bot]@users.noreply.github.com>
Co-authored-by: mentatbot[bot] <160964065+mentatbot[bot]@users.noreply.github.com>
- Print an error message and exit with code 1 if the file is not found
- Validate file extension and print an error message if it does not have the .xlsx extension
- Follow cargo clippy suggestion:
- Use `is_some_and` instead of `map_or` to validate the file extension
- Print an error message and exit if the file extension is not `.xlsx`
@sangshuduo sangshuduo merged commit fbb14f6 into main Nov 30, 2024
4 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.

1 participant