Skip to content

Conversation

@chikof
Copy link
Contributor

@chikof chikof commented Apr 20, 2025

Changes

  • Basically "rewrite" the whole thing
  • Test almost all test cases. I'm speeding up the process, so I'll have the rest of the tests ready sometime in the future.
  • Add opt‑in CLI config source and priority‑based merging

Linked Issues

chikof added 2 commits April 20, 2025 16:39
- Add ConfigSource trait and merge_sections helper
- Implement ConfigFileSource accepting an optional FileFormat
- Feature-gated ClapSource for CLI flags (cli feature)
- Build ConfigBuilder in macro expansion (preserves existing format
attribute)
- Update `impl_block.rs` to use `builder.load()` under the hood
- Add unit tests for merge logic and file/CLI sources
- Add integration tests for `#[cruct]` macro with and without cli
feature
…ation

- Update `ClapSource::new()` in cruct_shared to accept ArgMatches
instead of Command
- Fix procedural macro implementation to properly parse CLI arguments:
  - Generate CLI command parsing with get_matches() before creating
ClapSource
  - Add dynamic CLI flag generation based on struct fields in
impl_block.rs
- Ensure feature-gated CLI integration works with config builder pattern

This resolves type mismatches in the macro-generated code and enables
actual CLI argument parsing
when using the #[cruct] macro with the 'cli' feature enabled.
@chikof chikof self-assigned this Apr 20, 2025
@chikof chikof added assigned This PR is assigned to an issue. feature This is assigned to PRs that implement a feature. labels Apr 20, 2025
chikof added 8 commits April 20, 2025 23:26
- Rename `get_parser_by_extension` to `get_parser` and improve error
handling
- Add `get_file_extension` utility with proper error for missing
extensions
- Expand scalar type support with implementations for numeric types,
char, and usize/isize
- Introduce `parse_value` helper for consistent type conversion errors
- Refactor config sources to use centralized extension handling
- Remove obsolete `UnsupportedType` error variant
- Update YAML and TOML parsers to use more explicit imports
- Improve error messages with contextual information about parsing
failures
This commit also features the implementation of loading multiple config
files at once with a priority.
@codecov
Copy link

codecov bot commented Jul 2, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@chikof chikof changed the title feat: add opt‑in CLI config source and priority‑based merging re-write cruct Jul 2, 2025
@chikof chikof marked this pull request as ready for review July 10, 2025 19:03
@chikof chikof merged commit a4ac0c2 into main Jul 10, 2025
3 checks passed
@chikof chikof deleted the feat/cli-config-sources branch July 10, 2025 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assigned This PR is assigned to an issue. feature This is assigned to PRs that implement a feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: CLI Configuration Support (Clap/StructOpt/Custom) with Priority-Based Merging

1 participant