workspacer_show/
show_flags.rs1crate::ix!();
3
4#[derive(Clone,StructOpt,Setters,MutGetters,Getters,Builder,Debug)]
10#[builder(setter(into))]
11#[getset(get="pub",get_mut="pub",set="pub")]
12pub struct ShowFlags {
13 #[structopt(long = "path", parse(from_os_str))]
15 path: Option<PathBuf>,
16
17 #[structopt(long = "include-private")]
19 #[builder(default="false")]
20 include_private: bool,
21
22 #[structopt(long = "include-docs")]
24 #[builder(default="false")]
25 include_docs: bool,
26
27 #[structopt(long = "include-tests")]
29 #[builder(default="false")]
30 include_tests: bool,
31
32 #[structopt(long = "include-fn-bodies")]
34 #[builder(default="false")]
35 include_fn_bodies: bool,
36
37 #[structopt(long = "include-test-bodies")]
39 #[builder(default="false")]
40 include_test_bodies: bool,
41
42 #[structopt(long = "just-tests")]
44 #[builder(default="false")]
45 just_tests: bool,
46
47 #[structopt(long = "just-fns")]
49 #[builder(default="false")]
50 just_fns: bool,
51
52 #[structopt(long = "just-impls")]
54 #[builder(default="false")]
55 just_impls: bool,
56
57 #[structopt(long = "just-traits")]
59 #[builder(default="false")]
60 just_traits: bool,
61
62 #[structopt(long = "just-enums")]
64 #[builder(default="false")]
65 just_enums: bool,
66
67 #[structopt(long = "just-structs")]
69 #[builder(default="false")]
70 just_structs: bool,
71
72 #[structopt(long = "just-aliases")]
74 #[builder(default="false")]
75 just_aliases: bool,
76
77 #[structopt(long = "just-adts")]
79 #[builder(default="false")]
80 just_adts: bool,
81
82 #[structopt(long = "just-macros")]
84 #[builder(default="false")]
85 just_macros: bool,
86
87 #[structopt(long = "group-by-file")]
89 #[builder(default="false")]
90 group_by_syntax_kind: bool,
91
92 #[structopt(long = "merge-crates")]
95 #[builder(default="false")]
96 merge_crates: bool,
97
98 #[structopt(long = "show-items-with-no-data")]
101 #[builder(default="false")]
102 show_items_with_no_data: bool,
103
104 #[structopt(long = "full", conflicts_with_all = &["for_ai", "for_ai_no_tests"])]
106 full: bool,
107
108 #[structopt(long = "for-ai", conflicts_with_all = &["full", "for_ai_no_tests"])]
109 for_ai: bool,
110
111 #[structopt(long = "for-ai-no-tests", conflicts_with_all = &["full", "for_ai"])]
112 for_ai_no_tests: bool,
113}
114
115impl ShowFlags {
116
117 pub fn crate_dependency_consolidation_options(&self) -> ConsolidationOptions {
118 let mut base = ConsolidationOptions::from(self);
119 if *self.for_ai() || *self.for_ai_no_tests() {
120 base = base.with_tests_disabled();
121 }
122 base
123 }
124}
125
126impl From<&ShowFlags> for ConsolidationOptions {
127
128 fn from(opts: &ShowFlags) -> ConsolidationOptions {
129 let mut c = ConsolidationOptions::new();
131
132 if *opts.full() {
133 c = c.with_docs()
139 .with_private_items()
140 .with_test_items()
141 .with_fn_bodies()
142 .with_fn_bodies_in_tests();
143 }
144 else if *opts.for_ai() {
145 c = c.with_private_items()
152 .with_test_items() .with_fn_bodies()
154 .with_fn_bodies_in_tests();
155 }
156 else if *opts.for_ai_no_tests() {
157 c = c.with_private_items()
159 .with_fn_bodies();
161 }
163 else {
164 if *opts.include_docs() {
166 c = c.with_docs();
167 }
168 if *opts.include_private() {
169 c = c.with_private_items();
170 }
171 if *opts.include_tests() {
172 c = c.with_test_items();
173 }
174 if *opts.include_fn_bodies() {
175 c = c.with_fn_bodies();
176 }
177 if *opts.include_test_bodies() {
178 c = c.with_fn_bodies_in_tests();
179 }
180 if *opts.just_tests() {
181 c = c.with_only_test_items();
182 }
183 }
184
185 c.validate();
186 c
187 }
188}