-
Notifications
You must be signed in to change notification settings - Fork 1
feat(connection): enhance printer listing functionality for Windows #100
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
Conversation
…ability - Replace byte slice initialization with make and append for better clarity - Update buffer sizes for command construction to enhance performance - Clean up comments for improved understanding of the code
- Add options to list all, thermal, and physical printers - Implement error handling for printer enumeration - Update command-line flags for improved usability
|
👋 Thanks for opening this PR, @adcondev! Here's what will happen next:
Please make sure:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enhances printer listing functionality for Windows, improves command buffer allocation efficiency, and modernizes the linting configuration. The changes primarily focus on Windows printer detection and enumeration capabilities while also optimizing memory allocation patterns throughout the codebase.
Changes:
- Added comprehensive printer listing commands (--list, --list-thermal, --list-physical, --json) with detailed printer information display
- Refactored printer detection logic to use new enumeration and filtering capabilities
- Optimized buffer allocation using pre-allocated capacities in command construction and tests
- Updated linting configuration with detailed comments and modern Go best practices
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/poster/main.go | Added printer listing functionality with JSON output support and new CLI flags |
| cmd/poster/printing.go | Refactored detectPrinter() to use new enumeration functions with thermal printer prioritization |
| cmd/poster/printing_stub.go | Added stub for non-Windows platforms |
| pkg/connection/windows_enum.go | Added error handling and nolint directives for Windows API calls |
| pkg/connection/windows_connector.go | Translated error messages from Spanish to English |
| pkg/connection/printer_info.go | Added documentation comments for PrinterState constants |
| pkg/commands/*/**.go | Optimized buffer allocation using make with capacity |
| pkg/commands/*/**_test.go | Updated test buffer initialization with appropriate capacities |
| .golangci.yml | Modernized configuration with detailed comments and categorized linters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7673781 to
2ce0381
Compare
2ce0381 to
711b5bc
Compare
⚡ Benchmark Results📈 Performance Comparison📊 Click to expand detailed resultsCurrent Branch ResultsBase Branch Results💡 Note: Use 🎯 Summary
|
…lysis - Updated the golangci-lint configuration to disable all linters by default and enable specific ones. - Enhanced comments for clarity on each linter's purpose and importance. - Adjusted settings for gocyclo, goconst, and gosec to improve code quality checks. - Added configurations for errorlint to enforce better error handling practices. Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
711b5bc to
ee2d80b
Compare
e268d20 to
7ac9464
Compare
7ac9464 to
d960f37
Compare
- Restore 'v' prefix logic in release commit message format - Update bump files to include both package.json and package-lock.json - Remove Go-specific scripts that crash the Node.js environment - Enhance regex for detecting breaking changes in release analysis - Implement error handling for standard-version execution Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
d960f37 to
096db5d
Compare
📝 Description
This pull request introduces significant improvements to the release automation, CLI usability, and code quality configuration for the Poster project. The most notable changes include robust fixes to the release workflow to prevent version/tag errors and infinite loops, enhanced printer listing and auto-detection features in the CLI (especially for Windows users), and a clearer, more maintainable linter configuration. Several minor bugs and documentation issues have also been addressed.
Release Workflow and Automation Improvements
.github/workflows/release.ymlto prevent infinite release loops by ignoring commits with "chore(release)" or "[skip ci]" in the message, fixed regex for detecting breaking changes, and added error handling for the release process to avoid "vnull" tags and ensure proper version extraction and tag pushing. Also improved handling of empty release notes and streamlined Go module publication steps. [1] [2] [3] [4].versionrc.jsto restore the 'v' prefix in release tags, ensure bothpackage.jsonandpackage-lock.jsonare updated, and removed Go-specific scripts to prevent Node.js environment crashes. [1] [2]CLI and Printer Detection Enhancements
cmd/poster/main.goto allow listing all, thermal, or physical printers on Windows, with optional JSON output. Improved the printer listing implementation to use the new connection layer, including filtering and detailed output. Updated help and examples accordingly. [1] [2] [3] [4] [5]cmd/poster/printing.goto prefer default thermal printers, fall back to common name patterns, and finally use the default physical printer if available. Now utilizes the new printer listing/filtering functions for accuracy and maintainability. [1] [2]Code Quality and Documentation
.golangci.ymlfor clarity and maintainability, grouping linters by theme, improving documentation, and ensuring the config is suitable for CI environments.Other Minor Updates
4.4.0incmd/poster/main.go.os) for JSON output functionality in the CLI.These changes collectively improve the reliability of releases, enhance the user experience for Windows printer management, and ensure code quality standards are easier to maintain.
🎯 Type of Change
🎯 Component(s) Affected
composer- ESC/POS protocol composerconnection- Printer connectionscommands- ESC/POS command implementationsbuilder- Document builderexecutor- Document processinggraphics- Image processingtables- Table formatting and layoutemulator- Visual emulatorprofile- Printer profilesservice- High-level printer servicegithub- GitHub related files and workflows🧪 How Has This Been Tested?
Test Configuration
🤖 Automated Checks
The following automated workflows will run on this PR:
✅ Checklist
📸 Screenshots/Examples
Click to expand
// Example code here💥 Breaking Changes
🔗 Related Issues
📝 Additional Notes
📚 Resources: