pit in Rust
2017-12-29 - ⧖ 1.0 minhttps://github.com/hhatto/pit-rs
最近コマンドラインツールをよく書いていて、 パスワード等を扱うことが多くなってきたので必要にかられて書きました。
以下のような形で使えます。
[ dependencies ]
pit = { git = "https://github.com/hhatto/pit-rs", branch = "master" }
extern crate pit;
use pit:: Pit ;
fn main () {
let p = Pit :: new ();
let config = p. get ( "twitter.com" );
match config {
None => {
println! ( "not provide config value" );
return ;
},
Some ( _) => {},
}
let config = config. unwrap ();
let username = config. get ( "username" ). unwrap ();
let password = config. get ( "password" ). unwrap ();
println! ( "username={}, password={}" , username, password);
}
ドキュメント書いて、 crates.io あたりにも登録したいと思います。 来年あたりに。。。