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
use clap::{Parser, ValueEnum};
use std::path::PathBuf;
use crate::retry::RetrySetting;
use crate::time_limit::TimeScale;
#[derive(Parser)]
#[command(name = "toad", version, about = "A developer-friendly REST client")]
pub struct Cli {
/// Path to the collection file (omit when using --listen)
pub file: Option<PathBuf>,
/// Name of the request to run (omits runs all)
pub requests: Option<String>,
// Optional output format/verbosity
#[arg(short, long, value_enum)]
pub output: Option<OutputFormat>,
// Only list requests in file
#[arg(short, long)]
pub list_requests: bool,
// Optional profile name to use for vars
#[arg(short, long)]
pub profile: Option<String>,
/// Listen for inbound requests on this port and log/record them, instead of running a collection
#[arg(long, conflicts_with = "file")]
pub listen: Option<u16>,
/// Append captured request output to this file (only used with --listen)
#[arg(long, requires = "listen")]
pub output_file: Option<PathBuf>,
/// Path to a custom CA bundle (PEM, JKS, or PKCS12) to trust, overriding any
/// `use_custom_ca` set in the collection file's [config]
#[arg(long)]
pub use_custom_ca: Option<PathBuf>,
/// Password for the custom CA keystore (JKS/PKCS12 only; not needed for PEM).
/// Falls back to the TOAD_CA_PASSWORD environment variable if unset.
#[arg(long)]
pub use_custom_ca_password: Option<String>,
/// Multiply every expect_max_ms limit by this factor, or 'off' to skip time limits.
/// Falls back to the TOAD_TIME_SCALE environment variable if unset.
#[arg(long, value_name = "FACTOR|off")]
pub time_scale: Option<TimeScale>,
/// Retry failed requests this many times, replacing any [config] retry (a request's own
/// retry still wins), or 'off' to never retry. Falls back to the TOAD_RETRY environment
/// variable if unset.
#[arg(long, value_name = "N|off")]
pub retry: Option<RetrySetting>,
}
#[derive(ValueEnum, Clone, Default, PartialEq)]
pub enum OutputFormat {
#[default]
Normal,
Quiet,
Silent,
Verbose,
ResponseOnly,
RequestOnly,
}