rust-cli / rust-cli/config-rs

No option to exclude keys from case conversion

Open
#625 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-env C-enhancement
Dominant language
Rust
Stars
3.2k
Forks
265
Avg merge
2h 42m
Merged PRs (30d)
4

Description

Currently, it is not possible to specify a list of keys that should be excluded from case conversion.

In my case, this makes it hard to build a config from an Environment and a File, where some identifiers in the file are kebab-case, while other parameters are snake_case.

For example, I want a kebab-case key and a snake_case configuration:

# TOML configuration
[foo.kebab-case-key]
snake_case_configuration = "bar"
# Environment configuration
FOO__KEBAB_CASE_KEY__SNAKE_CASE_CONFIGURATION=bar

While there is a method convert_case, it is applied to all collected keys. For this example, a possible solution would be something like:

Environment::default().convert_case_exclude_keys(Case::Kebab, ["snake_case_configuration"]);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Environment::with_convert_case and its documentation to understand how case conversion is applied. Add support for excluding named keys while converting other keys, and verify that the kebab-case and snake_case configuration example can be represented as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.