feature/add-cli-display #1
16
src/cli.rs
16
src/cli.rs
@ -34,11 +34,19 @@ struct Args {
|
|||||||
action: Action,
|
action: Action,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_kind(kind_arg: &NotationKindArg) -> NotationKind {
|
impl Into<NotationKind> for NotationKindArg {
|
||||||
match kind_arg {
|
fn into(self) -> NotationKind {
|
||||||
|
(&self).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<NotationKind> for &NotationKindArg {
|
||||||
|
fn into(self) -> NotationKind {
|
||||||
|
match self {
|
||||||
NotationKindArg::Iso => NotationKind::Iso,
|
NotationKindArg::Iso => NotationKind::Iso,
|
||||||
NotationKindArg::Uns => NotationKind::Uns,
|
NotationKindArg::Uns => NotationKind::Uns,
|
||||||
NotationKindArg::Alphanumeric => NotationKind::Alphanumeric,
|
NotationKindArg::Alphanumeric => NotationKind::Alphanumeric,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,10 +55,10 @@ pub fn run_cli() {
|
|||||||
|
|
||||||
match &args.action {
|
match &args.action {
|
||||||
Action::Convert { from, to, value } => {
|
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 {
|
let output_string = match tooth_result {
|
||||||
Ok(tooth) => tooth.to(&convert_kind(to)),
|
Ok(tooth) => tooth.to(&to.into()),
|
||||||
Err(err) => err,
|
Err(err) => err,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user