combu is a customizable cli framework. The library name "combu" comes from command + 昆布(konbu, it means kelp in japanese).
combu has no dependencies(or depends on only std library). Crate.io's page is here.
combu(com + 昆布)ã¯æŸ”軟㫠CLI を組ã¿ä¸Šã’られるã“ã¨ã‚’目標ã¨ã—ãŸã€ã‚«ã‚¹ã‚¿ãƒžã‚¤ã‚ºå¯èƒ½ãª CLI フレームワークã§ã™ï¼ˆä¸€æ™‚クレートã®åå‰ãŒ cmb ã ã£ãŸã“ã¨ã‚‚ã‚ã‚Šã¾ã—ãŸãŒã€ç¾åœ¨ã¯ combu ã§ã™ï¼‰ã€‚
Combu exists on crates.io. You can use(or import) this crate like other crate that exists on crates.io.
combu 㯠crates.io ã«ç™»éŒ²ã—ã¦ã‚ã‚Šã¾ã™ã®ã§ã€ä»–ã® crates.io 上ã®ã‚¯ãƒ¬ãƒ¼ãƒˆã¨åŒã˜ã‚ˆã†ã«ä½¿ç”¨ï¼ˆã‚¤ãƒ³ãƒãƒ¼ãƒˆï¼‰ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚
Add
toml
combu="[version you want to use]"
to cargo.toml.
上記コードã§ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’指定ã—ã¦ã€cargo.toml ã«è¿½åŠ ã—ã¦ãã ã•ã„。
If you installed cargo-edit, exec below command under the target project:
bash
cargo add combu
cargo-edit をインストールã—ã¦ã‚ã‚‹å ´åˆã¯ã€ä¸Šè¨˜ã®ã‚³ãƒžãƒ³ãƒ‰ã‚’実行ã™ã‚‹ã“ã¨ã§ä½¿ç”¨å¯èƒ½ã§ã™ã€‚
```rust use combu::command::presets::func::helptablizewithaliasdedup; use combu::{actionresult, checkerror, checkhelp, done, presetroot, Command}; use combu::{Context, Flag}; use std::env;
fn main() { let r = presetroot!(act) .usage(env!("CARGOPKGNAME").tostring() + " [args]") .commonflag( Flag::newbool("help") .shortalias('h') .description("show help"), ) .localflag( Flag::newbool("local") .shortalias('l') .description("local flag"), ) .runfrom_args(env::args().collect()); }
fn act(cmd: Command, c: Context) -> actionresult!() { checkerror!(cmd, c); checkhelp!(cmd, c, helptablizewithalias_dedup); println!("Hello, combu - {:?}", c.args);
done!()
} ```
If you want to run quick start as example, exec
bash
cargo run --example quick_start
cargo run --example quick_start --help
More detail: See quick_start.rs
command.rs
ã¯æ¸ˆã‚“ã§ã„ã‚‹ã€å®˜åƒšã¯ç„¡æœŸé™æœªå®š)If you want to contribute combu, please read CONTRIBUTING.md for checking our code of conduct, and submitting pull requests to us.
README Contribute: ksk001100 contributed on this pull request.
This is licensed under MIT LICENSE
This readme is mainly based on seahorse's readme - Copyright (c) 2019 Keisuke Toyota - licensed MIT License.