feature/add-cli-display #1

Merged
guilhem merged 4 commits from feature/add-cli-display into development 2022-08-04 14:56:41 +00:00
Showing only changes of commit 519ae2a261 - Show all commits

View File

@ -34,23 +34,31 @@ struct Args {
action: Action,
}
fn convert_kind(kind_arg: &NotationKindArg) -> NotationKind {
match kind_arg {
impl Into<NotationKind> for NotationKindArg {
fn into(self) -> NotationKind {
(&self).into()
}
}
impl Into<NotationKind> for &NotationKindArg {
fn into(self) -> NotationKind {
match self {
NotationKindArg::Iso => NotationKind::Iso,
NotationKindArg::Uns => NotationKind::Uns,
NotationKindArg::Alphanumeric => NotationKind::Alphanumeric,
}
}
}
pub fn run_cli() {
let args = Args::parse();
match &args.action {
Action::Convert { from, to, value } => {
let tooth_result = Tooth::from(value, &convert_kind(from));
let tooth_result = Tooth::from(value, &from.into());
let output_string = match tooth_result {
Ok(tooth) => tooth.to(&convert_kind(to)),
Ok(tooth) => tooth.to(&to.into()),
Err(err) => err,
};