random_output/
args.rs

1use clap::Parser;
2
3#[derive(Debug, Parser)]
4#[command(author, version, about = "Output random lines to stdout and stderr")]
5pub struct Args {
6    #[arg(short = 'n', help = "Number of stdout lines", default_value_t = 10)]
7    pub stdout_lines: usize,
8
9    #[arg(short = 'e', help = "Number of stderr lines", default_value_t = 10)]
10    pub stderr_lines: usize,
11
12    #[arg(
13        long = "wait",
14        help = "Specify how long to wait between outputs in <ms>",
15        default_value_t = 0
16    )]
17    pub wait_ms: u64,
18
19    #[arg(long = "prefix", help = "Prefix to add each line", default_value = "")]
20    pub prefix: String,
21
22    #[arg(long = "suffix", help = "Suffix to add each line", default_value = "")]
23    pub suffix: String,
24
25    #[arg(
26        long = "prefix-err",
27        help = "Prefix to add each stderr line. Defaults to `--prefix`"
28    )]
29    pub prefix_err: Option<String>,
30
31    #[arg(
32        long = "suffix-err",
33        help = "Suffix to add each stderr line. Defaults to `--suffix`"
34    )]
35    pub suffix_err: Option<String>,
36
37    #[arg(long = "exit", help = "Exit code of the process", default_value_t = 0)]
38    pub exit_code: i32,
39
40    #[arg(
41        long = "date",
42        short = 'd',
43        help = "Show dates in [%yyyy-%mm-%dd %HH:%MM:%SS.%3f] style"
44    )]
45    pub with_dates: bool,
46
47    #[arg(
48        long = "level",
49        short = 'l',
50        help = "Show [INFO] for stdout and [ERR] for stderr"
51    )]
52    pub with_loglevels: bool,
53
54    #[arg(
55        long = "color",
56        short = 'c',
57        help = "Make dates gray, [INFO] green and [ERR] red"
58    )]
59    pub with_colors: bool,
60
61    #[arg(
62        long = "working-dir",
63        short = 'w',
64        help = "Show working dir in the first line"
65    )]
66    pub with_working_dir: bool,
67}