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 step2;
8 pub use step2::*;
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 }
15 }
16 pub mod logic {
17 pub mod anchored_paths_datum;
18 pub use anchored_paths_datum::{AnchoredPathsDatum, PathNode};
19 pub mod path_patterns;
20 pub use path_patterns::{PattEnvIndex, PattExp, PattRaw, PatternsQueries};
21 pub mod fs_scanner;
22 pub use fs_scanner::{
23 MatchLabel,
24 MatchedDir,
25 MatchedFile,
26 MismatchedDir,
27 MismatchedFile,
28 NodeIs,
29 Partition,
30 PartitionScanned,
31 ScannedDirNode,
32 ScannedFileNode,
33 ScannedNode,
34 StatsPartitioning,
35 StatsScannedTreeFs,
36 is_binary_file,
37 };
38 pub mod path_context;
39 pub use path_context::PathContext;
40 pub mod specification;
46 pub use specification::{
47 JobMode,
48 JobSpec,
49 ScanSpec,
50 TabColumn,
51 TabPathStructure,
52 TabSortBy,
53 TabSortOrder,
54 TabSpec,
55 };
56 pub mod tag_time;
57 pub use tag_time::{TagTime, tag_time};
58 pub mod mapper_lang_type;
59 pub use mapper_lang_type::LangMapper;
60 pub mod config_model;
65 pub use config_model::{
66 ConfigExport,
67 ConfigJob,
68 ConfigLayout,
69 ConfigManifest,
70 ConfigSpec,
71 ConfigTrimming,
72 ScanRawJobNew,
73 };
74 pub mod file_toml_config;
75 pub use file_toml_config::IoConfig;
76 }
77 pub mod display {
82
83 pub mod anchored_paths_datum;
84 pub mod config;
85 pub mod job_spec;
86 use colored::*;
92
93 pub struct Color;
94 impl Color {
95 pub fn tree(s: &str) -> ColoredString { s.truecolor(41, 211, 152) }
96 pub fn num(s: &str) -> ColoredString { s.bright_magenta() }
97 pub fn size(s: &str) -> ColoredString { s.cyan() }
98 pub fn date(s: &str) -> ColoredString { s.truecolor(140, 120, 100) }
99 pub fn time(s: &str) -> ColoredString { s.truecolor(100, 70, 100) }
100 pub fn folder(s: &str) -> ColoredString { s.truecolor(200, 200, 50).bold() }
101 pub fn file(s: &str) -> ColoredString { s.bright_white() }
102 pub fn binary(s: &str) -> ColoredString { s.bright_red() }
103 pub fn border(s: &str) -> ColoredString { s.truecolor(20, 20, 20).dimmed() }
104 }
105
106 pub struct Icon;
108
109 impl Icon {
110 pub const EMPTY: &'static str = "β";
111 pub const ENTRY: &'static str = "ποΈ ";
113 pub const EXPAND: &'static str = "π";
115 pub const BOOL_FALSE: &'static str = "βοΈ ";
116 pub const FILE: &'static str = "π";
117 pub const FOLDER: &'static str = "π";
118 pub const H2: &'static str = "π";
120 pub const FILE2: &'static str = "π";
121 pub const FILE2_HIDDEN: &'static str = "βοΈ ";
122 pub const FOLDER2: &'static str = "π";
124 pub const FOLDER2_HIDDEN: &'static str = "ποΈ";
125 pub const LANG_RUST: &'static str = "π¦";
126 pub const BOOL_TRUE: &'static str = "βοΈ ";
128
129 #[inline]
130 pub fn bool(val: bool) -> &'static str { if val { Self::BOOL_TRUE } else { Self::BOOL_FALSE } }
131 }
132
133 pub trait BoolExt {
135 fn as_symbol(&self) -> &'static str;
136 }
137
138 impl BoolExt for bool {
139 fn as_symbol(&self) -> &'static str { Icon::bool(*self) }
140 }
141 pub struct TreeLast;
142 impl TreeLast {
143 pub const DIR_NO_CHILDREN: &'static str = "ββββ";
144 pub const DIR_WITH_CHILDREN: &'static str = "ββββ¬";
145 pub const FILE: &'static str = "ββββ’";
146 pub const INDENT: &'static str = " ";
147 }
148 pub struct TreeMid;
149 impl TreeMid {
150 pub const DIR_NO_CHILDREN: &'static str = "ββββ";
151 pub const DIR_WITH_CHILDREN: &'static str = "ββββ¬";
152 pub const FILE: &'static str = "ββββ’";
153 pub const INDENT: &'static str = "β ";
154 }
155
156 pub struct DrawTree;
157 impl DrawTree {
158 pub const ENTRY_BRANCH: &'static str = " ββββ";
159 pub const ENTRY_TERMINAL: &'static str = " ββββ";
161 pub const ITEM: &'static str = " β’";
163 pub const ITEM_BETWEEN: &'static str = " ββββ’";
165 pub const ITEM_FIRST: &'static str = " ββββ’";
167 pub const ITEM_LAST: &'static str = " ββββ’";
169 pub const ITEM_ONEFOLD: &'static str = " βββ’";
171
172 pub fn list(index: usize, total: usize) -> &'static str {
177 if total == 1 {
178 Self::ITEM_ONEFOLD
179 } else if index == 0 {
180 Self::ITEM_FIRST
181 } else if index == total - 1 {
182 Self::ITEM_LAST
183 } else {
184 Self::ITEM_BETWEEN
185 }
186 }
187
188 pub fn tree(is_dir: bool, is_last: bool, has_children: bool) -> (&'static str, &'static str) {
190 let branch = if is_dir {
191 match (is_last, has_children) {
192 (true, true) => TreeLast::DIR_WITH_CHILDREN,
193 (false, true) => TreeMid::DIR_WITH_CHILDREN,
194 (true, false) => TreeLast::DIR_NO_CHILDREN,
195 (false, false) => TreeMid::DIR_NO_CHILDREN,
196 }
197 } else if is_last {
198 TreeLast::FILE
199 } else {
200 TreeMid::FILE
201 };
202
203 let next_indent = if is_last { TreeLast::INDENT } else { TreeMid::INDENT };
204
205 (branch, next_indent)
206 }
207 }
208 }
209}