1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Documentation generation system
//!
//! # Command line parser documentation generation
//!
//! [`OptionParser`] implements two methods: [`render_html`](OptionParser::render_html) and
//! [`render_manpage`](OptionParser::render_manpage) that create a documentation in a mix of
//! html/markdown and ROFF formats respectively.
//!
//! To use it you should do something like this
//! ```
//! #[test]
//! fn update_doc() {
//! # use bpaf::*;
//! # let options = || short('a').switch().to_options();
//! let options = options();
//! let md = options.render_markdown("app_name");
//! let roff = options.render_manpage("app_name", Section::General, None, None, None);
//! # drop(md); drop(roff);
//! // then save those docs into a files
//! // If you commit those docs into your repo and optionally fail a test if there
//! // are changes - CI will ensure that documentation is always up to date
//! }
//! ```
//!
//! # Documentation fragments to use inside `--help` messages
//!
//! `bpaf` tries to use semantic approach to documentation generation, instead of describing what
//! color specific string slice should be you need to specify what this string slice supposed to
//! mean.
//!
//! Most of the help related functions take `Into<Doc>` parameters, normally you would pass one of
//! following things:
//!
//! 1. Ready made `Doc` - usually with combinatoric API
//! ```ignore
//! # use bpaf::doc::Doc;
//! let mut doc = Doc::default();
//! doc.emphasis("Usage: ");
//! doc.literal("my_program"); // or use `env!("CARGO_BIN_NAME")` to get the name of the executable
//! // do something with it
//! drop(doc)
//! ```
//! 2. A string slice - `&str` can be converted into a fully plain text `Doc` which is enough
//! for most applications
//!
//! 3. A slice of style value pairs
//!
//! 4. A structure from your own crate that can be converted into `Doc`
//!
pub use crate;
pub use crateSection;
use crate::*;