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
// SPDX-License-Identifier: Apache-2.0
//! `heddle discuss` — durable repository collaboration.
use clap::{Args, Subcommand};
#[derive(Clone, Debug, Subcommand)]
pub enum DiscussCommands {
/// Open a discussion anchored to a symbol.
Open(DiscussOpenArgs),
/// Append a durable turn to a discussion.
Append(DiscussAppendArgs),
/// Resolve a discussion.
Resolve(DiscussResolveArgs),
/// Reopen a resolved discussion.
Reopen(DiscussReopenArgs),
/// List repository discussions.
List(DiscussListArgs),
/// Show one discussion and its causal heads.
Show(DiscussShowArgs),
}
#[derive(Clone, Debug, Args)]
pub struct DiscussOpenArgs {
/// Path of the file containing the symbol.
pub file: String,
/// Symbol name (for example `Repository::open`).
pub symbol: String,
/// First turn of the discussion.
pub body: String,
/// Human-readable summary. Defaults to the first line of the first turn.
#[arg(long)]
pub title: Option<String>,
/// State the symbol anchor was observed against. Defaults to HEAD.
#[arg(long)]
pub state: Option<String>,
/// Visibility: `public` | `internal` | `team:NAME` | `restricted:LABEL` | `private:LABEL`.
#[arg(long)]
pub visibility: Option<String>,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussAppendArgs {
pub discussion_id: String,
pub body: String,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussResolveArgs {
pub discussion_id: String,
/// Resolution kind: `by-edit` or `dismiss`.
#[arg(long, value_enum)]
pub mode: ResolveModeArg,
/// For `by-edit`: state containing the edit (defaults to HEAD).
#[arg(long)]
pub state: Option<String>,
/// For `dismiss`: non-empty reason.
#[arg(long)]
pub reason: Option<String>,
}
#[derive(Clone, Debug, clap::ValueEnum)]
pub enum ResolveModeArg {
ByEdit,
Dismiss,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussReopenArgs {
pub discussion_id: String,
/// Why the prior resolution no longer applies.
#[arg(long)]
pub reason: String,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussListArgs {
/// Filter by the state named in the discussion anchor.
#[arg(long)]
pub state: Option<String>,
/// Filter by anchored file path.
#[arg(long)]
pub file: Option<String>,
/// Filter by anchored symbol. Requires `--file`.
#[arg(long)]
pub symbol: Option<String>,
/// Status filter: `open`, `resolved`, `conflicted`, or `all`.
#[arg(long, default_value = "open")]
pub status: String,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussShowArgs {
pub discussion_id: String,
}