20 lines
472 B
Rust
20 lines
472 B
Rust
|
extern crate echobox;
|
||
|
use echobox::Echobox;
|
||
|
|
||
|
use std::env;
|
||
|
|
||
|
#[macro_use]
|
||
|
extern crate log;
|
||
|
extern crate env_logger;
|
||
|
|
||
|
const ECHOBOX_FILE: &'static str = "echobox.db";
|
||
|
|
||
|
fn main () {
|
||
|
env_logger::init().unwrap();
|
||
|
|
||
|
let in_quote = &env::args().nth(1).expect("Expected quote as first argument.")[..];
|
||
|
let echobox = Echobox::with_file(ECHOBOX_FILE).unwrap();
|
||
|
let out_quote = echobox.echo(in_quote).unwrap();
|
||
|
println!("{}: {}", out_quote.id, out_quote.text);
|
||
|
}
|