bird_tool_utils_man/
section.rs1use crate::{Flag, FlagOrOption, Opt};
2
3#[derive(Debug)]
5pub struct Section {
6 pub(crate) name: String,
7 pub(crate) paragraphs: Vec<String>,
8 pub(crate) flags_and_options: Vec<Box<dyn FlagOrOption>>,
9}
10
11impl Section {
12 pub fn new(name: &str) -> Self {
13 Self {
14 name: name.into(),
15 paragraphs: vec![],
16 flags_and_options: vec![],
17 }
18 }
19
20 pub fn paragraph(mut self, text: &str) -> Self {
21 self.paragraphs.push(text.into());
22 self
23 }
24
25 pub fn flag(mut self, flag: Flag) -> Self {
27 self.flags_and_options.push(Box::new(flag));
28 self
29 }
30
31 pub fn option(mut self, opt: Opt) -> Self {
33 self.flags_and_options.push(Box::new(opt));
34 self
35 }
36}