todo_tree/printer/
options.rs1use std::path::PathBuf;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum OutputFormat {
9 Tree,
11 Flat,
13 Json,
15}
16
17#[derive(Debug, Clone)]
19pub struct PrintOptions {
20 pub format: OutputFormat,
22 pub colored: bool,
24 pub show_line_numbers: bool,
26 pub full_paths: bool,
28 pub clickable_links: bool,
30 pub base_path: Option<PathBuf>,
32 pub show_summary: bool,
34 pub group_by_tag: bool,
36}
37
38impl Default for PrintOptions {
39 fn default() -> Self {
40 Self {
41 format: OutputFormat::Tree,
42 colored: true,
43 show_line_numbers: true,
44 full_paths: false,
45 clickable_links: true,
46 base_path: None,
47 show_summary: true,
48 group_by_tag: false,
49 }
50 }
51}
52
53#[cfg(test)]
54mod tests {
55 use super::*;
56
57 #[test]
58 fn default_options_use_tree_format_and_color() {
59 let options = PrintOptions::default();
60 assert_eq!(options.format, OutputFormat::Tree);
61 assert!(options.colored);
62 assert!(options.show_line_numbers);
63 assert!(!options.full_paths);
64 assert!(options.clickable_links);
65 assert!(options.base_path.is_none());
66 assert!(options.show_summary);
67 assert!(!options.group_by_tag);
68 }
69
70 #[test]
71 fn output_format_equality() {
72 assert_eq!(OutputFormat::Tree, OutputFormat::Tree);
73 assert_ne!(OutputFormat::Tree, OutputFormat::Json);
74 }
75}