1use clap::ValueEnum;
2
3pub mod ordering_huson2023;
4pub mod ordering_matrix;
5pub mod ordering_splitstree4;
6
7#[derive(ValueEnum, Clone, Debug)]
9pub enum OrderingMethod {
10 Huson2023,
11 SplitsTree4,
12}
13
14impl OrderingMethod {
15 pub fn as_str(&self) -> &str {
16 match self {
17 OrderingMethod::Huson2023 => "Huson2023",
18 OrderingMethod::SplitsTree4 => "SplitsTree4",
19 }
20 }
21
22 pub fn from_str(s: &str) -> Self {
23 match s {
24 "Huson2023" | "huson2023" => OrderingMethod::Huson2023,
25 "SplitsTree4" | "splitstree4" | "splits-tree4" => OrderingMethod::SplitsTree4,
26 _ => OrderingMethod::default(),
27 }
28 }
29
30 pub fn from_option(opt: Option<&str>) -> Self {
31 match opt {
32 Some("Huson2023") | Some("huson2023") => OrderingMethod::Huson2023,
33 Some("SplitsTree4") | Some("splitstree4") | Some("splits-tree4") => {
34 OrderingMethod::SplitsTree4
35 }
36 _ => OrderingMethod::default(),
37 }
38 }
39}
40
41impl Default for OrderingMethod {
42 fn default() -> Self {
43 OrderingMethod::SplitsTree4
44 }
45}