{"id":13595565,"url":"https://github.com/clap-rs/paw","last_synced_at":"2025-04-09T13:32:27.883Z","repository":{"id":57653631,"uuid":"174210458","full_name":"clap-rs/paw","owner":"clap-rs","description":"[wip] Command line argument paw-rser.","archived":true,"fork":false,"pushed_at":"2019-09-06T13:42:22.000Z","size":50,"stargazers_count":158,"open_issues_count":4,"forks_count":4,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-05-20T01:33:34.862Z","etag":null,"topics":[],"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/clap-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-06T19:50:10.000Z","updated_at":"2024-03-03T19:29:24.000Z","dependencies_parsed_at":"2022-08-26T06:41:01.439Z","dependency_job_id":null,"html_url":"https://github.com/clap-rs/paw","commit_stats":null,"previous_names":["rust-cli/paw"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clap-rs%2Fpaw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clap-rs%2Fpaw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clap-rs%2Fpaw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clap-rs%2Fpaw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clap-rs","download_url":"https://codeload.github.com/clap-rs/paw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248049477,"owners_count":21039223,"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":[],"created_at":"2024-08-01T16:01:52.589Z","updated_at":"2025-04-09T13:32:27.855Z","avatar_url":"https://github.com/clap-rs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# paw\n[![crates.io version][1]][2] [![build status][3]][4]\n[![downloads][5]][6] [![docs.rs docs][7]][8]\n\nCommand line argument paw-rser abstraction for main.\n\nPaw's goal is to show that C's idea of passing arguments into main wasn't that\nbad at all, but just needed a bit of oxidation to make it work with Rust.\n\nPaw defines a trait, a proc macro, and an example implementation that when\ncombined allow you to pass fully parsed arguments to main. Gone is the need to\nremember which methods to call in order to parse arguments in the CLI. Instead\npaw makes command line parsing feel first-class\n\n- [Documentation][8]\n- [Crates.io][2]\n- [Releases][releases]\n\n## Examples\n```rust\n#[paw::main]\nfn main(args: paw::Args) {\n    for arg in args {\n        println!(\"{:?}\", arg);\n    }\n}\n```\n\n__More Examples__\n- [Scratch](https://github.com/rust-cli/paw/tree/master/examples/scratch.rs)\n- [Args](https://github.com/rust-cli/paw/tree/master/examples/args.rs)\n- [Structopt](https://github.com/rust-cli/paw/tree/master/examples/structopt.rs)\n\n## Installation\n```sh\n$ cargo add paw\n```\n\n## Safety\nThis crate uses ``#![deny(unsafe_code)]`` to ensure everything is implemented in\n100% Safe Rust.\n\n## Contributing\nWant to join us? Check out our [\"Contributing\" guide][contributing] and take a\nlook at some of these issues:\n\n- [Issues labeled \"good first issue\"][good-first-issue]\n- [Issues labeled \"help wanted\"][help-wanted]\n\n## FAQ\n### How does paw work?\nThe `paw::main` attribute allows `fn main` to take any argument that implements the `paw::ParseArgs`\ntrait. `paw::ParseArgs` implements one method: `parse_args` which returns a `Result\u003cSelf\u003e`.\n\nAny errors that are generated are returned back from `fn main`, and the returned `Result` type is in\ncontrol of how to print them.\n\n### What is the relationship to C?\nIn C's runtime, arguments command line arguments are passed as a combination of \"number of\narguments\" (`argc`), and a \"list of arguments\" (`argv`):\n```c\nint main(int argc, char **argv) {\n    for(i = 1; i \u003c argc; i++) {\n        printf(\"%s\",argv[i]);\n    }\n    return 0;\n}\n```\n\nIn Rust this would translate to an iterator of arguments, which is what\n[`std::env::Args`](https://doc.rust-lang.org/std/env/struct.Args.html) provides, which is wrapped in\n`paw` through [`paw::Args`](https://docs.rs/paw/target/doc/paw/struct.Args.html).\n\n### What's the future for paw?\nPaw is an experiment by the CLI WG to provide a better command line experience for everyone. Our\nhypothesis is that by moving command line parsing to `fn main` Rust's command line experience can\nbecome more intuitive and easy to use.\n\nWe hope to gather feedback how this works for people, and see how we can integrate with existing\nlibraries. This will take time, and we might change things in the process.\n\nIf this experiment proves to be successful, we might move to formalize the features Paw provide into\nRust itself through the RFC process. But that's not the case yet, so for now: we hope you enjoy Paw,\nand we'd love to hear your about your experiences using it!\n\n## License\n[MIT](./LICENSE-MIT) OR [Apache-2.0](./LICENSE-APACHE)\n\n[1]: https://img.shields.io/crates/v/paw.svg?style=flat-square\n[2]: https://crates.io/crates/paw\n[3]: https://img.shields.io/travis/yoshuawuyts/paw/master.svg?style=flat-square\n[4]: https://travis-ci.org/yoshuawuyts/paw\n[5]: https://img.shields.io/crates/d/paw.svg?style=flat-square\n[6]: https://crates.io/crates/paw\n[7]: https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square\n[8]: https://docs.rs/paw\n\n[releases]: https://github.com/yoshuawuyts/paw/releases\n[contributing]: https://github.com/yoshuawuyts/paw/blob/master.github/CONTRIBUTING.md\n[good-first-issue]: https://github.com/yoshuawuyts/paw/labels/good%20first%20issue\n[help-wanted]: https://github.com/yoshuawuyts/paw/labels/help%20wanted\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclap-rs%2Fpaw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclap-rs%2Fpaw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclap-rs%2Fpaw/lists"}