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
combu="[version you want to use]"
to cargo.toml.
上記コードでバージョンを指定して、cargo.toml に追加してください。
If you installed cargo-edit, exec below command under the target project:
cargo add combu
cargo-edit をインストールしてある場合は、上記のコマンドを実行することで使用可能です。
use combu::command::presets::func::help_tablize_with_alias_dedup;
use combu::{action_result, check_error, check_help, done, preset_root, Command};
use combu::{Context, Flag};
use std::env;
fn main() {
let _r = preset_root!(act)
.usage(env!("CARGO_PKG_NAME").to_string() + " [args]")
.common_flag(
Flag::new_bool("help")
.short_alias('h')
.description("show help"),
)
.local_flag(
Flag::new_bool("local")
.short_alias('l')
.description("local flag"),
)
.run_from_args(env::args().collect());
}
fn act(cmd: Command, c: Context) -> action_result!()
{
check_error!(cmd, c);
check_help!(cmd, c, help_tablize_with_alias_dedup);
println!("Hello, combu - {:?}", c.args);
done!()
}
}
If you want to run quick start as example, exec
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.
Version | Tag | Published |
---|---|---|
1.1.15 | 21d ago | |
1.1.14 | 1mo ago | |
1.1.13 | 1mo ago | |
1.1.12 | 1mo ago |