{"id":24756354,"url":"https://github.com/dalance/structopt-toml","last_synced_at":"2025-10-11T02:31:39.984Z","repository":{"id":30733630,"uuid":"125829822","full_name":"dalance/structopt-toml","owner":"dalance","description":"An default value loader from TOML for structopt","archived":false,"fork":false,"pushed_at":"2023-11-07T20:11:07.000Z","size":56,"stargazers_count":28,"open_issues_count":5,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T16:47:26.176Z","etag":null,"topics":["argument-parsing","command-line-parser","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"dalance"}},"created_at":"2018-03-19T09:02:40.000Z","updated_at":"2024-01-04T12:30:31.000Z","dependencies_parsed_at":"2023-02-16T22:46:04.888Z","dependency_job_id":null,"html_url":"https://github.com/dalance/structopt-toml","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fstructopt-toml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fstructopt-toml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fstructopt-toml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fstructopt-toml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalance","download_url":"https://codeload.github.com/dalance/structopt-toml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236026033,"owners_count":19083307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argument-parsing","command-line-parser","rust"],"created_at":"2025-01-28T13:51:05.984Z","updated_at":"2025-10-11T02:31:34.706Z","avatar_url":"https://github.com/dalance.png","language":"Rust","readme":"# structopt-toml\nAn default value loader from TOML for structopt.\nIt combinates with [structopt](https://github.com/TeXitoi/structopt).\n\n[![Actions Status](https://github.com/dalance/structopt-toml/workflows/Rust/badge.svg)](https://github.com/dalance/structopt-toml/actions)\n[![Crates.io](https://img.shields.io/crates/v/structopt-toml.svg)](https://crates.io/crates/structopt-toml)\n[![Docs.rs](https://docs.rs/structopt-toml/badge.svg)](https://docs.rs/structopt-toml)\n[![codecov](https://codecov.io/gh/dalance/structopt-toml/branch/master/graph/badge.svg)](https://codecov.io/gh/dalance/structopt-toml)\n\n## Usage\n\nThis crate must be used with `serde`, `serde_derive`, `structopt`, and `toml` explicitly.\n\n```Cargo.toml\n[dependencies]\nserde          = \"1.0.104\"\nserde_derive   = \"1.0.104\"\nstructopt      = \"0.3.11\"\nstructopt-toml = \"0.5.1\"\ntoml           = \"0.5.6\"\n```\n\n## Example\n\nIf `derive(Deserialize)`, `derive(StructOptToml)` and `serde(default)` are added to the struct with `derive(StructOpt)`, some functions like `from_args_with_toml` can be used.\n\n```rust\nuse serde_derive::Deserialize;\nuse structopt::StructOpt;\nuse structopt_toml::StructOptToml;\n\n#[derive(Debug, Deserialize, StructOpt, StructOptToml)]\n#[serde(default)]\nstruct Opt {\n    #[structopt(default_value = \"0\", short = \"a\")] a: i32,\n    #[structopt(default_value = \"0\", short = \"b\")] b: i32,\n}\n\nfn main() {\n    let toml_str = r#\"\n        a = 10\n    \"#;\n    let opt = Opt::from_args_with_toml(toml_str).expect(\"toml parse failed\");\n    println!(\"a:{}\", opt.a);\n    println!(\"b:{}\", opt.b);\n}\n```\n\nThe execution result is below.\n\n```console\n$ ./example\na:10        // value from TOML string\nb:0         // value from default_value of structopt\n\n$ ./example -a 20\na:20        // value from command line argument\nb:0\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n","funding_links":["https://github.com/sponsors/dalance"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Fstructopt-toml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalance%2Fstructopt-toml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Fstructopt-toml/lists"}