1pub mod align;
39pub mod bar;
40pub mod box_drawing;
41pub mod console;
42pub mod emoji;
43pub mod group;
44pub mod highlighter;
45pub mod markup;
46pub mod measure;
47pub mod nested_progress;
48pub mod padding;
49pub mod pager;
50pub mod renderable;
51pub mod screen;
52pub mod style;
53pub mod text;
54pub mod theme;
55
56pub mod columns;
58pub mod filesize;
59pub mod layout;
60pub mod live;
61pub mod log;
62pub mod panel;
63pub mod rule;
64pub mod table;
65pub mod tree;
66
67pub mod progress;
69
70pub mod inspect;
72pub mod prompt;
73pub mod traceback;
74
75#[cfg(feature = "markdown")]
77pub mod markdown;
78
79#[cfg(feature = "syntax")]
80pub mod syntax;
81
82pub use console::Console;
84pub use layout::Layout;
85pub use live::Live;
86pub use panel::{BorderStyle, Panel};
87pub use renderable::Renderable;
88pub use rule::Rule;
89pub use style::{Color, Style};
90pub use table::{Column, ColumnAlign, Table};
91pub use text::{Alignment, Text};
92pub use tree::{Tree, TreeNode};
93
94pub mod prelude {
96 pub use crate::columns::Columns;
97 pub use crate::console::Console;
98 pub use crate::inspect::{inspect, InspectConfig};
99 pub use crate::log::ConsoleLog;
100 pub use crate::panel::{BorderStyle, Panel};
101 pub use crate::progress::{track, Progress, ProgressBar, Spinner, SpinnerStyle, Status};
102 pub use crate::renderable::Renderable;
103 pub use crate::rule::Rule;
104 pub use crate::style::{Color, Style};
105 pub use crate::table::{Column, ColumnAlign, Table};
106 pub use crate::text::{Alignment, Text};
107 pub use crate::traceback::install_panic_hook;
108 pub use crate::tree::{GuideStyle, Tree, TreeNode};
109}
110
111pub fn print(content: &str) {
121 Console::new().print(content);
122}
123
124pub fn println(content: &str) {
126 Console::new().println(content);
127}
128
129#[cfg(test)]
130mod tests {
131 use super::*;
132
133 #[test]
134 fn test_console_creation() {
135 let console = Console::new();
136 assert!(console.get_width() > 0);
137 }
138
139 #[test]
140 fn test_style_builder() {
141 let style = Style::new().foreground(Color::Red).bold().underline();
142
143 assert!(style.bold);
144 assert!(style.underline);
145 }
146
147 #[test]
148 fn test_text_creation() {
149 let text = Text::plain("Hello, World!");
150 assert_eq!(text.plain_text(), "Hello, World!");
151 }
152
153 #[test]
154 fn test_table_creation() {
155 let mut table = Table::new();
156 table.add_column("Col1");
157 table.add_column("Col2");
158 table.add_row_strs(&["a", "b"]);
159
160 assert!(!table
162 .render(&console::RenderContext {
163 width: 40,
164 height: None
165 })
166 .is_empty());
167 }
168}