cargo_plot/theme/
for_path_tree.rs1pub const DIR_ICON: &str = "📂";
7
8pub const FILE_ICON: &str = "📄";
9
10pub struct PathFileType {
13 pub icon: &'static str,
14 pub md_lang: &'static str,
15}
16
17#[must_use]
20pub fn get_file_type(ext: &str) -> PathFileType {
21 match ext {
22 "rs" => PathFileType {
23 icon: "🦀",
24 md_lang: "rust",
25 },
26 "toml" => PathFileType {
27 icon: "⚙️",
28 md_lang: "toml",
29 },
30 "slint" => PathFileType {
31 icon: "🎨",
32 md_lang: "slint",
33 },
34 "md" => PathFileType {
35 icon: "📝",
36 md_lang: "markdown",
37 },
38 "json" => PathFileType {
39 icon: "🔣",
40 md_lang: "json",
41 },
42 "yaml" | "yml" => PathFileType {
43 icon: "🛠️",
44 md_lang: "yaml",
45 },
46 "html" => PathFileType {
47 icon: "📖",
48 md_lang: "html",
49 },
50 "css" => PathFileType {
51 icon: "🖌️",
52 md_lang: "css",
53 },
54 "js" => PathFileType {
55 icon: "📜",
56 md_lang: "javascript",
57 },
58 "ts" => PathFileType {
59 icon: "📘",
60 md_lang: "typescript",
61 },
62 _ => PathFileType {
65 icon: "📄",
66 md_lang: "text",
67 },
68 }
69}
70
71#[derive(Debug, Clone)]
74pub struct TreeStyle {
75 pub dir_last_with_children: String, pub dir_last_no_children: String, pub dir_mid_with_children: String, pub dir_mid_no_children: String, pub file_last: String, pub file_mid: String, pub indent_last: String, pub indent_mid: String, }
92
93impl Default for TreeStyle {
94 fn default() -> Self {
95 Self {
96 dir_last_with_children: "└──┬".to_string(),
97 dir_last_no_children: "└───".to_string(),
98 dir_mid_with_children: "├──┬".to_string(),
99 dir_mid_no_children: "├───".to_string(),
100
101 file_last: "└──•".to_string(),
102 file_mid: "├──•".to_string(),
103
104 indent_last: " ".to_string(),
105 indent_mid: "│ ".to_string(),
106 }
107 }
108}