{"id":15471427,"url":"https://github.com/aisk/rust-fire","last_synced_at":"2025-05-01T10:55:56.647Z","repository":{"id":139776925,"uuid":"122919956","full_name":"aisk/rust-fire","owner":"aisk","description":"Turn your function(s) to a command line app with one line of code.","archived":false,"fork":false,"pushed_at":"2024-03-13T08:57:41.000Z","size":14,"stargazers_count":5,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T10:55:52.493Z","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":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aisk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-02-26T05:51:12.000Z","updated_at":"2024-12-05T21:25:02.000Z","dependencies_parsed_at":"2023-12-04T14:01:09.366Z","dependency_job_id":null,"html_url":"https://github.com/aisk/rust-fire","commit_stats":null,"previous_names":["aisk/rust-fire"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Frust-fire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Frust-fire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Frust-fire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Frust-fire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aisk","download_url":"https://codeload.github.com/aisk/rust-fire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251864175,"owners_count":21656289,"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-10-02T02:19:34.918Z","updated_at":"2025-05-01T10:55:56.624Z","avatar_url":"https://github.com/aisk.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Fire\n\n![logo](https://orion-uploads.openroadmedia.com/lg_805c44212fcc-rengoku-2.jpg)\n\nTurn your function(s) to a command line app. Inspires by Google's [Python Fire](https://github.com/google/python-fire).\n\n## Installation\n\n```sh\ncargo add fire\n```\n\n## Usage\n\n```rust\n// Turn a single function to CLI app.\n#[fire::fire]\nfn welcome() {\n    println!(\"Welcome!\");\n}\n\n// Turn mutilple functions to CLI app.\n#[fire::fire]\nmod some_functions {\n    pub fn hello(name: String, times: i32) {\n        for _ in 0..times {\n            println!(\"Hello, {name}!\");\n        }\n    }\n\n    pub fn bye() {\n        println!(\"Bye!\");\n    }\n}\n\nfn main() {\n    // 'Fire' the functions with command line arguments.\n    fire::run!();\n}\n```\n\nNow you can run your CLI app. By default the single function `welcome` should be called:\n\n```sh\n$ cargo build\n$ ./target/debug/app\nWelcome!\n```\n\nThe funtions in the mod should be called as sub-command with it's function name:\n\n```sh\n$ cargo build\n$ ./target/debug/app bye\nBye!\n```\n\nFuntions with arguments will receive the arguments from CLI app arguments, with format like `--argname=argvalue`:\n\n```sh\n$ cargo build\n$ ./target/debug/app hello --name='John Smith' --times=3\nHello, John Smith!\nHello, John Smith!\nHello, John Smith!\n```\n\nFire will call `.parse()` on every argument (except `\u0026str`), so all types which implements [FromStr](https://doc.rust-lang.org/std/str/trait.FromStr.html) plus `\u0026str` is supported. For optional argument, you can use the `Option` generic type, like `Option\u003cString\u003e` or `Option\u003ci32\u003e`;\n\n## License\n\nLicensed under the [BSD](https://github.com/aisk/rust-fire/blob/master/LICENSE) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Frust-fire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faisk%2Frust-fire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Frust-fire/lists"}