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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
use crate::output::OutputFormat;
use camino::Utf8PathBuf;
use clap::Subcommand;
#[derive(Subcommand)]
pub enum ResolutionsCommand {
Create {
#[arg(long, default_value = ".")]
repo: Utf8PathBuf,
#[arg(long)]
scope: String,
#[arg(long)]
id: String,
#[arg(long)]
title: String,
#[arg(long)]
requirement_id: Option<String>,
#[arg(long)]
position: String,
#[arg(long)]
rationale: String,
#[arg(long, default_value = "proposed")]
status: String,
#[arg(long)]
context: Option<String>,
#[arg(long)]
enforcement: Option<String>,
#[arg(long)]
confidence: Option<f64>,
#[arg(long = "input-type")]
input_type: Vec<String>,
#[arg(long = "input-reference")]
input_reference: Vec<String>,
#[arg(long = "input-summary")]
input_summary: Vec<String>,
#[arg(long)]
made_by: Option<String>,
#[arg(long)]
approved_by: Option<String>,
#[arg(long)]
approved_at: Option<i64>,
#[arg(long)]
superseded_by: Option<String>,
#[arg(long)]
origin_thread: Option<String>,
#[arg(long)]
origin_message: Option<String>,
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
},
}
#[derive(Subcommand)]
// `Create` carries every field of a rule; the read verbs carry three flags.
#[allow(clippy::large_enum_variant)]
pub enum RulesCommand {
/// Write a new rule into the scope.
Create {
/// Repository holding the `.provenance` directory.
#[arg(long, default_value = ".")]
repo: Utf8PathBuf,
/// Scope the rule belongs to.
#[arg(long)]
scope: String,
/// Stable id for the rule, used by `#[rule]` and `#[verifies]` sites.
#[arg(long)]
id: String,
/// Short human label. The statement carries the meaning; this is only
/// what a reader scanning a list sees first.
#[arg(long)]
name: Option<String>,
/// Longer prose about the rule, for anything the statement leaves out.
#[arg(long)]
description: Option<String>,
/// Requirement this rule serves. Must already exist in the scope.
#[arg(long)]
requirement_id: Option<String>,
/// Resolution that produced this rule. Must already exist in the scope.
#[arg(long)]
resolution_id: Option<String>,
/// What must be true, in one sentence a reader can check code against.
#[arg(long)]
statement: String,
/// One of `active`, `draft`, or `deprecated`.
#[arg(long, default_value = "active")]
status: String,
/// How much a breach costs: `low`, `medium`, `high`, or `critical`.
#[arg(long, default_value = "medium")]
severity: String,
/// Document the rule was read out of, such as an award or a standard.
#[arg(long)]
source_document: Option<String>,
/// Clause or section within that document.
#[arg(long)]
source_section: Option<String>,
/// Shaping thread the rule came out of.
#[arg(long)]
origin_thread: Option<String>,
/// Message within that thread.
#[arg(long)]
origin_message: Option<String>,
/// How to print the created rule.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
},
/// List the rules in a scope, one summary line of record each.
List {
/// Repository holding the `.provenance` directory.
#[arg(long, default_value = ".")]
repo: Utf8PathBuf,
/// Scope to list.
#[arg(long, default_value = "default")]
scope: String,
/// How to print the list.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
},
/// Print one rule in full.
Show {
/// Repository holding the `.provenance` directory.
#[arg(long, default_value = ".")]
repo: Utf8PathBuf,
/// Scope the rule belongs to.
#[arg(long, default_value = "default")]
scope: String,
/// Id of the rule to print.
#[arg(long)]
id: String,
/// How to print the rule.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
},
}