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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! # Some of the more unusual examples
//!
//! While `bpaf`'s design tries to cover most common use cases, mostly
//! [posix conventions](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/V1_chap12.html),
//! it can also handle some more unusual requirements. It might come at a cost of having to write
//! more code, more confusing error messages or worse performance, but it will get the job done.

/// ## `find(1)`: `find -exec commands -flags terminated by \;`
///
#[doc = include_str!("docs/find.md")]
pub mod find {}

/// ## `dd(1)`: `dd if=/dev/zero of=/dev/null bs=1000`
///
#[doc = include_str!("docs/dd.md")]
pub mod dd {}

/// ## `Xorg(1)`: `Xorg +xinerama +extension name`
///
#[doc = include_str!("docs/xorg.md")]
pub mod xorg {}

/// ## [Command chaining](https://click.palletsprojects.com/en/7.x/commands/#multi-command-chaining): `setup.py sdist bdist`
///
/// Unlike `click`, `bpaf` allows commands to be nested as well for as long as the paring is not
/// ambiguous
#[doc = include_str!("docs/adjacent_2.md")]
pub mod chaining {}

/// ## Multi-value arguments: `--foo ARG1 ARG2 ARG3`
#[doc = include_str!("docs/adjacent_0.md")]
pub mod multi_value {}

/// ## Structure groups: `--foo --foo-1 ARG1 --foo-2 ARG2 --foo-3 ARG3`
///
/// Groups of options that can be specified multiple times. All such groups should be kept without
/// overwriting previous one.
///
///```console
/// $ prometheus_sensors_exporter \
///     \
///     `# 2 physical sensors located on physycial different i2c bus or address` \
///     --sensor \
///         --sensor-device=tmp102 \
///         --sensor-name="temperature_tmp102_outdoor" \
///         --sensor-i2c-bus=0 \
///         --sensor-i2c-address=0x48 \
///     --sensor \
///         --sensor-device=tmp102 \
///         --sensor-name="temperature_tmp102_indoor" \
///         --sensor-i2c-bus=1 \
///         --sensor-i2c-address=0x49 \
///```
#[doc = include_str!("docs/adjacent_1.md")]
pub mod struct_group {}

/// # Multi-value arguments with optional flags: `--foo ARG1 --flag --inner ARG2`
///
/// So you can parse things while parsing things. Not sure why you might need this, but you can
/// :)
///
#[doc = include_str!("docs/adjacent_4.md")]
pub mod multi_value_plus {}

/// # Skipping optional positional items if parsing or validation fails
///
#[doc = include_str!("docs/numeric_prefix.md")]
pub mod optional_pos {}
#[cfg(feature = "batteries")]
/// # Implementing cargo commands
///
/// With [`cargo_helper`] you can use your application as cargo command
#[doc = include_str!("docs/cargo_helper.md")]
pub mod cargohelper {}

#[cfg(all(doc, feature = "batteries"))]
use crate::batteries::cargo_helper;