split repository between CLI and librarry
This commit is contained in:
parent
cf133e462f
commit
618c6d57e8
15 changed files with 295 additions and 13 deletions
10
labirust-cli/Cargo.toml
Normal file
10
labirust-cli/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "labirust-cli"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
labirust = { path = "../labirust" }
|
||||
clap = { version = "3.1.18", features = ["derive"] }
|
37
labirust-cli/src/main.rs
Normal file
37
labirust-cli/src/main.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use clap::Parser;
|
||||
use labirust::{implementations::*, Executor};
|
||||
|
||||
enum Algorithms {
|
||||
DepthFirst,
|
||||
BreathFirst,
|
||||
}
|
||||
|
||||
impl FromStr for Algorithms {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"depth-first" => Ok(Self::DepthFirst),
|
||||
"breath-first" => Ok(Self::BreathFirst),
|
||||
_ => Err("No right pattern".into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Parameters {
|
||||
algorithm_kind: Algorithms,
|
||||
width: usize,
|
||||
height: usize,
|
||||
delay: usize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let params = Parameters::parse();
|
||||
|
||||
let executor = todo!();
|
||||
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue