Skip to content

Commit

Permalink
Support serde serialization and deserialization
Browse files Browse the repository at this point in the history
This commit adds serialization and deserialization support for the
Verbosity type. The verbosity is serialized using the log::LevelFilter
enum that represents the equivalent number of verbose and quiet flags.

The serialized value is the uppercase variant of the enum variant.
Deserialing is case-insensitive.

Fixes: clap-rs#88
  • Loading branch information
joshka committed Sep 26, 2024
1 parent 74d1e81 commit bc139a6
Show file tree
Hide file tree
Showing 3 changed files with 399 additions and 10 deletions.
121 changes: 115 additions & 6 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,19 @@ pre-release-replacements = [
[badges]
codecov = { repository = "clap-rs/clap-verbosity-flag" }

[features]
serde = ["dep:serde", "log/serde"]

[dependencies]
log = "0.4.1"
clap = { version = "4.0.0", default-features = false, features = ["std", "derive"] }
serde = { version = "1.0.210", features = ["derive"], optional = true}

[dev-dependencies]
clap = { version = "4.5.4", default-features = false, features = ["help", "usage"] }
env_logger = "0.11.3"
serde_test = { version = "1.0.177" }
toml = { version = "0.8.19" }
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-log = "0.2"
Expand Down
Loading

0 comments on commit bc139a6

Please sign in to comment.