1 个不稳定版本

使用旧的 Rust 2015

0.1.0 2018年1月17日

#241 in #account

MIT/Apache

9KB
142 代码行(不包括注释)

pit-rs

pit for Rust

使用说明

[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);
}

针对开发者

$ cargo test -- --test-threads=1

lib.rs:

pit

pit 是账户管理工具。

使用说明

[dependencies]
pit = "*"
$ mkdir -p ~/.pit
$ echo "profile: default" > ~/.pit/pit.yaml
$ echo "twitter.com:" >> ~/.pit/default.yaml
$ echo "    username: foo" >> ~/.pit/default.yaml
$ echo "    password: bar" >> ~/.pit/default.yaml
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);
}

依赖项

~140KB