Add initial codebase
This commit is contained in:
parent
2c876a3714
commit
fa4beeebcd
5 changed files with 74 additions and 1 deletions
5
imag-store/src/create.rs
Normal file
5
imag-store/src/create.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
use libimagrt::runtime::Runtime;
|
||||
|
||||
pub fn create(rt: &Runtime) {
|
||||
}
|
||||
|
5
imag-store/src/delete.rs
Normal file
5
imag-store/src/delete.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
use libimagrt::runtime::Runtime;
|
||||
|
||||
pub fn delete(rt: &Runtime) {
|
||||
}
|
||||
|
|
@ -7,10 +7,63 @@ extern crate libimagrt;
|
|||
extern crate libimagstore;
|
||||
extern crate libimagutil;
|
||||
|
||||
use libimagrt::runtime::Runtime;
|
||||
use std::process::exit;
|
||||
|
||||
mod ui;
|
||||
mod create;
|
||||
mod read;
|
||||
mod update;
|
||||
mod delete;
|
||||
|
||||
use ui::build_ui;
|
||||
use create::create;
|
||||
use read::read;
|
||||
use update::update;
|
||||
use delete::delete;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let name = "imag-store";
|
||||
let version = &version!()[..];
|
||||
let about = "Direct interface to the store. Use with great care!";
|
||||
let ui = build_ui(Runtime::get_default_cli_builder(name, version, about));
|
||||
let rt = {
|
||||
let rt = Runtime::new(ui);
|
||||
if rt.is_ok() {
|
||||
rt.unwrap()
|
||||
} else {
|
||||
println!("Could not set up Runtime");
|
||||
println!("{:?}", rt.err().unwrap());
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
rt.init_logger();
|
||||
|
||||
debug!("Hello. Logging was just enabled");
|
||||
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
||||
debug!("Lets get rollin' ...");
|
||||
|
||||
rt.cli()
|
||||
.subcommand_name()
|
||||
.map_or_else(
|
||||
|| {
|
||||
debug!("No command");
|
||||
// More error handling
|
||||
},
|
||||
|name| {
|
||||
debug!("Call: {}", name);
|
||||
match name {
|
||||
"create" => create(&rt),
|
||||
"read" => read(&rt),
|
||||
"update" => update(&rt),
|
||||
"delete" => delete(&rt),
|
||||
_ => {
|
||||
debug!("Unknown command");
|
||||
// More error handling
|
||||
},
|
||||
};
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
|
5
imag-store/src/read.rs
Normal file
5
imag-store/src/read.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
use libimagrt::runtime::Runtime;
|
||||
|
||||
pub fn read(rt: &Runtime) {
|
||||
}
|
||||
|
5
imag-store/src/update.rs
Normal file
5
imag-store/src/update.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
use libimagrt::runtime::Runtime;
|
||||
|
||||
pub fn update(rt: &Runtime) {
|
||||
}
|
||||
|
Loading…
Reference in a new issue