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