Skip to content

Commit

Permalink
Merge pull request #7 from cbeck88/layered-config
Browse files Browse the repository at this point in the history
support for layered config using a serde Deserializer as a source
  • Loading branch information
cbeck88 authored Oct 14, 2024
2 parents c389f35 + 6fe4c69 commit 5fa7d83
Show file tree
Hide file tree
Showing 46 changed files with 5,779 additions and 829 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
key: default-features
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Build Rust
run: cargo check --verbose --locked
Expand All @@ -43,6 +44,32 @@ jobs:
- name: Check dirty git
uses: ./.github/actions/check-dirty-git

# builds and tests rust code, with --no-default-features, with --deny warnings. tests for dirty git
build-and-test-rust-no-default-features:
runs-on: ubuntu-latest

env:
RUSTFLAGS: --deny warnings

steps:
- uses: actions/checkout@v4
- name: Rustup update
run: rustup update
- name: Show cargo version
run: cargo --version
- name: rust build caching
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
key: no-default-features
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Build Rust
run: cargo check --no-default-features --verbose --locked
- name: Test Rust
run: cargo test --no-default-features --verbose --locked
- name: Check dirty git
uses: ./.github/actions/check-dirty-git

# lints and checks formatting of rust code
lint-rust:
runs-on: ubuntu-latest
Expand Down
174 changes: 130 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ include = [
[package]
name = "conf"
version = "0.1.1"
description = "A derive-based config parser for CLI args and env parameters"
categories = ["command-line-interface"]
description = "A derive-based config parser for CLI args, env, and structured config files"
categories = ["configuration"]
keywords = [
"argument",
"config",
Expand All @@ -42,10 +42,17 @@ bench = false
[dependencies]
conf_derive = { path = "./conf_derive", version = "0.1.1" }
clap = { version = "4.5.8", features = ["string"] }
clap_lex = { version = "0.7" }
serde = { version = "1", optional = true }

[features]
default = ["serde"]

[dev-dependencies]
assert_matches = "1.5"
escargot = "0.5"
figment = { version = "0.10", features = ["json", "toml"] }
http = { version = "1.1" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
url = "1"
toml = "0.8"
2 changes: 2 additions & 0 deletions MOTIVATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ The initial feature set was the features of `clap-derive` I had used most heavil
I ended up adding more features besides this before the first `crates.io` release as I started migrating more of my projects to this, and encountered things that were either harder to migrate, or were just additional features that I realized I wanted and could fit into the framework with relative ease.
In version 0.1.1, we added support for subcommands.
## Testing
If we change the same simple program that we used for testing `clap-derive` to use `conf` instead, we can see that the error handling in these scenarios becomes better.
Expand Down
Loading

0 comments on commit 5fa7d83

Please sign in to comment.