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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
use clap::Subcommand;
#[derive(Subcommand)]
#[expect(
clippy::large_enum_variant,
reason = "only constructed once from CLI args"
)]
pub enum TemplateAction {
/// Save (or replace) a named bug-creation template.
///
/// Templates store reusable defaults for `bzr bug create`. At
/// least one default field must be supplied (`--product`,
/// `--component`, `--version`, `--priority`, `--severity`,
/// `--assignee`, `--op-sys`, `--rep-platform`, or
/// `--description`); empty templates are rejected with exit
/// code 7 (input validation).
///
/// Saving over an existing template name replaces it. Templates
/// are stored locally in `~/.config/bzr/config.toml` and never
/// sent to the server -- they are pure CLI ergonomics.
///
/// Examples:
///
/// bzr template save security-bug --product Security \
/// --component Vulnerabilities --severity critical
/// bzr template save fedora-kernel --product Fedora \
/// --component kernel --priority high
///
/// See bzr-template-show(1) to inspect a template,
/// bzr-template-delete(1) to remove one, and bzr-bug-create(1)
/// for the `--template` flag that applies one.
#[command(verbatim_doc_comment)]
Save {
/// Template name
name: String,
/// Default product
#[arg(long)]
product: Option<String>,
/// Default component
#[arg(long)]
component: Option<String>,
/// Default version
#[arg(long)]
version: Option<String>,
/// Default priority
#[arg(long)]
priority: Option<String>,
/// Default severity
#[arg(long)]
severity: Option<String>,
/// Default assignee
#[arg(long)]
assignee: Option<String>,
/// Default operating system
#[arg(long)]
op_sys: Option<String>,
/// Default hardware platform
#[arg(long)]
rep_platform: Option<String>,
/// Default description
#[arg(long)]
description: Option<String>,
},
/// List all saved templates.
///
/// Prints each template's name and a short summary of its
/// stored defaults. Use `--json` for a structured listing.
///
/// Examples:
///
/// bzr template list
/// bzr template list --json | jq '.templates[].name'
///
/// See bzr-template-show(1) for the full parameters of one
/// template.
#[command(verbatim_doc_comment)]
List,
/// Show the stored defaults of one saved template.
///
/// Prints the template's name and every default field it
/// stores. Useful for verifying what `bzr bug create
/// --template <name>` will pre-fill.
///
/// Examples:
///
/// bzr template show security-bug
/// bzr template show security-bug --json
///
/// See bzr-template-list(1) for the inventory and
/// bzr-bug-create(1) to apply a template.
#[command(verbatim_doc_comment)]
Show {
/// Template name
name: String,
},
/// Delete a saved template.
///
/// Removes the named template from the local config. Does not
/// prompt for confirmation -- if recovery is needed, restore
/// the previous `~/.config/bzr/config.toml` from backup or
/// re-run `bzr template save`.
///
/// Examples:
///
/// bzr template delete security-bug
///
/// See bzr-template-list(1) to verify the template exists
/// first.
#[command(verbatim_doc_comment)]
Delete {
/// Template name
name: String,
},
}