Skip to main content

plot/
api.rs

1pub mod lib {
2	pub mod job {
3		pub mod config;
4		pub use config::*;
5		//pub mod step0;
6		//pub use step0::*;
7		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 paths_table;
51		// pub use paths_table::{FileKind, TableData, TableRow, TableSotcTreeOutput};
52		// pub mod paths_result;
53		// pub use paths_result::{Matched, Mismatched,PartitioningResult};
54
55		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 engine;
71		// pub use engine::{JobEngine, MX, RenderFlags};
72		// pub mod engine_multiple;
73		// pub use engine_multiple::DocEngineMultiple;
74		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 command {
88	// 	pub mod args;
89	// 	pub mod help;
90	// }
91	pub mod display {
92
93		pub mod anchored_paths_datum;
94		pub mod config;
95		pub mod job_spec;
96		// pub mod fs_scanner;
97		// pub mod paths_patterns;
98		// pub mod paths_result;
99		// pub mod table_data;
100
101		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		/// [POL]: Scentralizowane symbole formatowania dla projektu.
117		pub struct Icon;
118
119		impl Icon {
120			pub const EMPTY: &'static str = "β­•";
121			// --- Symbole zasobΓ³w ---
122			pub const ENTRY: &'static str = "πŸ—ƒοΈ ";
123			// --- Symbole dla Entry (TwΓ³j styl z obrazka) ---
124			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			// --- Symbole sekcji ---
129			pub const H2: &'static str = "πŸ“š";
130			pub const FILE2: &'static str = "πŸ“„";
131			pub const FILE2_HIDDEN: &'static str = "βš™οΈ ";
132			// ⚑ --- Symbole zasobów (Rozszerzone - z wersji OLD) ---
133			pub const FOLDER2: &'static str = "πŸ“";
134			pub const FOLDER2_HIDDEN: &'static str = "πŸ—ƒοΈ";
135			pub const LANG_RUST: &'static str = "πŸ¦€";
136			// --- Symbole logiczne (Bool) ---
137			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		/// [POL]: Rozszerzenie dla bool, aby pisać `val.as_symbol()`.
144		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			// view::fs::entry
170			pub const ENTRY_TERMINAL: &'static str = "  └───";
171			// view::fs::entry
172			pub const ITEM: &'static str = "     β€’";
173			// view::path::pattern
174			pub const ITEM_BETWEEN: &'static str = "  β”œβ”€β”€β€’";
175			// self
176			pub const ITEM_FIRST: &'static str = "  β”Œβ”€β”€β€’";
177			// view::fs::filter
178			pub const ITEM_LAST: &'static str = "  └──‒";
179			// self
180			pub const ITEM_ONEFOLD: &'static str = "   ──‒";
181
182			// self
183
184			/// Automatycznie dobiera symbol gaΕ‚Δ™zi na podstawie indeksu i
185			/// rozmiaru listy.
186			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			/// Zwraca krotkΔ™: (symbol_gaΕ‚Δ™zi_dla_siebie, wciΔ™cie_dla_dzieci)
199			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}