Conversation
- Add /export command to save current 3D view to file - Implement content-aware trimming with 2-char margin - Fix success/error message display and ESC handling - Export uses single newlines for web compatibility
- Add ExportFormat enum (Plain, Color, Html) - /export: plain text format (default, no colors) - /export --color: ANSI colored text format - /export --html: self-contained HTML format for web embedding - Support filename arguments with format flags - Update help documentation for new export options
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to export the 3D view as text in multiple formats for use in websites and other applications. The export command supports plain text, colored text with ANSI codes, and self-contained HTML formats.
Key changes:
- Added export command with flexible syntax supporting different output formats
- Implemented three export formats: plain text, ANSI colored text, and HTML
- Added success message display system to complement existing error messages
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/main.rs | Added export command handling, success message system, and updated command execution flow |
| src/graphics.rs | Implemented export functionality with three format options and text trimming utilities |
| src/args.rs | Updated help documentation to include export command usage examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| let timestamp = std::time::SystemTime::now() | ||
| .duration_since(std::time::UNIX_EPOCH) | ||
| .unwrap() | ||
| .as_secs(); |
There was a problem hiding this comment.
The timestamp generation logic is duplicated in multiple branches. Consider extracting this into a helper function to reduce code duplication.
| self.trim_output_with_margin(rows_output, 2) | ||
| } | ||
|
|
||
| fn export_color(&self) -> String { |
There was a problem hiding this comment.
The export_color and export_html methods contain nearly identical logic for processing Braille pixels and colors. Consider extracting the common pixel processing logic into a shared helper method to reduce code duplication.
| self.trim_output_with_margin(rows_output, 2) | ||
| } | ||
|
|
||
| fn export_html(&self) -> String { |
There was a problem hiding this comment.
The export_color and export_html methods contain nearly identical logic for processing Braille pixels and colors. Consider extracting the common pixel processing logic into a shared helper method to reduce code duplication.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for like, textual image representations in websites and stuff