Conversation
…ility - Add toml dependency for dual format support - Implement automatic format detection based on file extension - Add smart config file discovery (TOML preferred, JSON fallback) - Maintain full backward compatibility with existing JSON configs - Default new installations to TOML format for better readability - Update config path handling to support both extensions - Add comprehensive tests for both TOML and JSON formats - Update documentation with dual format examples and migration info - Mark issue #17 as complete in ROADMAP All acceptance criteria fulfilled: ✅ Creates default config file if not exists (TOML format) ✅ Loads printer settings from config (both formats) ✅ CLI arguments override config values (preserved functionality) ✅ Validates configuration format (format-specific error messages) ✅ Clear error messages for invalid config (JSON/TOML specific) Resolves #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key Features
Changes Made
toml = "0.8"for TOML parsing supportConfigFormatenum to distinguish between JSON/TOMLdetect_format()based on file extensionImplementation Details
Format Detection Logic
Smart Config Discovery
When loading configs, the system:
Format-Specific Error Handling
Testing
Configuration Examples
TOML Format (New Default)
JSON Format (Legacy Support)
{ "printers": { "my_printer": { "name": "my_printer", "ip": "192.168.1.100", "device_id": "01S00A000000000", "access_code": "12345678", "port": 8883, "use_tls": true } }, "default_printer": "my_printer", "mqtt_settings": { "keep_alive_secs": 30, "connection_timeout_secs": 10, "retry_attempts": 5, "retry_delay_secs": 5, "queue_size": 10 } }Acceptance Criteria ✅
Documentation Updates
Migration Path
Quality Assurance
cargo fmt)cargo clippy)This implementation provides a smooth transition to TOML while maintaining complete backward compatibility with existing JSON configurations.
Closes #17