1pub mod lib {
2 pub mod job {
3 pub mod config;
4 pub use config::*;
5 pub mod step1;
6 pub use step1::*;
7 pub mod gens {
8 pub mod item_icon;
9 pub mod item_list;
10 pub use item_icon::*;
11 pub use item_list::*;
12 }
13 pub mod step2;
14 pub use step2::*;
15 pub mod step3;
16 pub use step3::*;
17 }
18 pub mod logic {
19 pub mod anchored_paths_datum;
20 pub use anchored_paths_datum::{AnchoredPathsDatum, PathNode};
21 pub mod path_patterns;
22 pub use path_patterns::{PattEnvIndex, PattExp, PattRaw, PatternsQueries};
23 pub mod path_context;
24 pub use path_context::PathContext;
25 pub mod fs_scanner;
26 pub use fs_scanner::{
27 MatchLabel,
28 MatchedDir,
29 MatchedFile,
30 MismatchedDir,
31 MismatchedFile,
32 NodeIs,
33 Partition,
34 PartitionScanned,
35 ScannedDirNode,
36 ScannedFileNode,
37 ScannedNode,
38 StatsPartitioning,
39 StatsScannedTreeFs,
40 is_binary_file,
41 };
42 pub mod path_sort;
43 pub use path_sort::SortQueries;
44 pub mod specification;
50 pub use specification::{
51 JobMode,
52 JobSpec,
53 ScanSpec,
54 TabColumn,
55 TabPathStructure,
56 TabSortBy,
57 TabSortOrder,
58 TabSpec,
59 };
60 pub mod tag_time;
61 pub use tag_time::{TagTime, tag_time};
62 pub mod mapper_lang_type;
63 pub use mapper_lang_type::LangMapper;
64 pub mod config_model;
69 pub use config_model::{
70 ConfigExport,
71 ConfigJob,
72 ConfigLayout,
73 ConfigManifest,
74 ConfigSpec,
75 ConfigTrimming,
76 ScanRawJobNew,
77 };
78 pub mod file_toml_config;
79 pub use file_toml_config::IoConfig;
80 }
81 pub mod display {
86
87 pub mod anchored_paths_datum;
88 pub mod config;
89 pub mod job_spec;
90 use colored::*;
96
97 pub struct Color;
98 impl Color {
99 pub fn tree(s: &str) -> ColoredString { s.truecolor(41, 211, 152) }
100 pub fn num(s: &str) -> ColoredString { s.bright_magenta() }
101 pub fn size(s: &str) -> ColoredString { s.cyan() }
102 pub fn date(s: &str) -> ColoredString { s.truecolor(140, 120, 100) }
103 pub fn time(s: &str) -> ColoredString { s.truecolor(100, 70, 100) }
104 pub fn folder(s: &str) -> ColoredString { s.truecolor(200, 200, 50).bold() }
105 pub fn file(s: &str) -> ColoredString { s.bright_white() }
106 pub fn binary(s: &str) -> ColoredString { s.bright_red() }
107 pub fn border(s: &str) -> ColoredString { s.truecolor(20, 20, 20).dimmed() }
108 }
109
110 pub struct Icon;
112
113 impl Icon {
114 pub const EMPTY: &'static str = "β";
115 pub const ENTRY: &'static str = "ποΈ ";
117 pub const EXPAND: &'static str = "π";
119 pub const BOOL_FALSE: &'static str = "βοΈ ";
120 pub const FILE: &'static str = "π";
121 pub const FOLDER: &'static str = "π";
122 pub const H2: &'static str = "π";
124 pub const FILE2: &'static str = "π";
125 pub const FILE2_HIDDEN: &'static str = "βοΈ ";
126 pub const FOLDER2: &'static str = "π";
128 pub const FOLDER2_HIDDEN: &'static str = "ποΈ";
129 pub const LANG_RUST: &'static str = "π¦";
130 pub const BOOL_TRUE: &'static str = "βοΈ ";
132
133 #[inline]
134 pub fn bool(val: bool) -> &'static str { if val { Self::BOOL_TRUE } else { Self::BOOL_FALSE } }
135 }
136
137 pub trait BoolExt {
139 fn as_symbol(&self) -> &'static str;
140 }
141
142 impl BoolExt for bool {
143 fn as_symbol(&self) -> &'static str { Icon::bool(*self) }
144 }
145 pub struct TreeLast;
146 impl TreeLast {
147 pub const DIR_NO_CHILDREN: &'static str = "ββββ";
148 pub const DIR_WITH_CHILDREN: &'static str = "ββββ¬";
149 pub const FILE: &'static str = "ββββ’";
150 pub const INDENT: &'static str = " ";
151 }
152 pub struct TreeMid;
153 impl TreeMid {
154 pub const DIR_NO_CHILDREN: &'static str = "ββββ";
155 pub const DIR_WITH_CHILDREN: &'static str = "ββββ¬";
156 pub const FILE: &'static str = "ββββ’";
157 pub const INDENT: &'static str = "β ";
158 }
159
160 pub struct DrawTree;
161 impl DrawTree {
162 pub const ENTRY_BRANCH: &'static str = " ββββ";
163 pub const ENTRY_TERMINAL: &'static str = " ββββ";
165 pub const ITEM: &'static str = " β’";
167 pub const ITEM_BETWEEN: &'static str = " ββββ’";
169 pub const ITEM_FIRST: &'static str = " ββββ’";
171 pub const ITEM_LAST: &'static str = " ββββ’";
173 pub const ITEM_ONEFOLD: &'static str = " βββ’";
175
176 pub fn list(index: usize, total: usize) -> &'static str {
181 if total == 1 {
182 Self::ITEM_ONEFOLD
183 } else if index == 0 {
184 Self::ITEM_FIRST
185 } else if index == total - 1 {
186 Self::ITEM_LAST
187 } else {
188 Self::ITEM_BETWEEN
189 }
190 }
191
192 pub fn tree(is_dir: bool, is_last: bool, has_children: bool) -> (&'static str, &'static str) {
194 let branch = if is_dir {
195 match (is_last, has_children) {
196 (true, true) => TreeLast::DIR_WITH_CHILDREN,
197 (false, true) => TreeMid::DIR_WITH_CHILDREN,
198 (true, false) => TreeLast::DIR_NO_CHILDREN,
199 (false, false) => TreeMid::DIR_NO_CHILDREN,
200 }
201 } else if is_last {
202 TreeLast::FILE
203 } else {
204 TreeMid::FILE
205 };
206
207 let next_indent = if is_last { TreeLast::INDENT } else { TreeMid::INDENT };
208
209 (branch, next_indent)
210 }
211 }
212 }
213}