git-ents.gitmain
⌘K
foforge
cli.rs84 lines · 3.1 KB · rusthistorycomment on this file
1//! `git ents issue`'s argument grammar — `figue` derive definitions only.
2//!
3//! Per this project's engineering conventions, this module carries no
4//! logic: every doc comment here becomes `--help` text, and `git-ents`'s
5//! own `exe` module is the only place an [`IssueAction`] variant is
6//! interpreted.
7
8use std::path::PathBuf;
9
10use ents_attrs as ents;
11use facet::Facet;
12use figue as args;
13
14/// `git ents issue` actions.
15#[derive(Facet)]
16#[repr(u8)]
17pub enum IssueAction {
18 /// List the issues recorded in this repository.
19 ///
20 /// With --porcelain, emits a stable machine-readable form:
21 /// blank-line-separated records, each starting with the line
22 /// `<id> <state>` (the full id, never abbreviated), followed by a
23 /// `title <title>` line, `assignees <a, b>` and `labels <x, y>` lines
24 /// when non-empty, then the body with every line prefixed by one tab.
25 List {
26 /// Emit the stable machine-readable form described above.
27 #[facet(args::named, default)]
28 porcelain: bool,
29 },
30 /// Show one issue.
31 Show {
32 /// The issue's id.
33 #[facet(args::positional)]
34 id: String,
35 },
36 /// Create an issue. With --title omitted, opens $GIT_EDITOR/$EDITOR on
37 /// a scratch file: its first line becomes the title, the remaining
38 /// lines become the body, lines starting with '#' are stripped, and
39 /// leaving the title empty aborts the command.
40 New {
41 /// The issue's title; omit to compose it (and the body) in an
42 /// editor instead.
43 #[facet(args::named, ents::compose)]
44 title: Option<String>,
45 /// The issue's body; ignored (and instead composed in the editor)
46 /// when --title is omitted.
47 #[facet(args::named, ents::compose)]
48 body: Option<String>,
49 /// The issue's initial state.
50 #[facet(args::named, default = "open")]
51 state: String,
52 /// Labels to attach (repeatable).
53 #[facet(args::named, args::label = "LABEL", default)]
54 label: Vec<String>,
55 /// Members to assign (repeatable).
56 #[facet(args::named, args::label = "USERNAME", default)]
57 assignee: Vec<String>,
58 /// Key to sign with; defaults to `user.signingkey`.
59 #[facet(args::named)]
60 key: Option<PathBuf>,
61 },
62 /// Edit an existing issue's state, assignees, and/or labels.
63 /// Assignees/labels replace the previous set entirely when given at
64 /// least one value; omit an option to leave that field unchanged.
65 Edit {
66 /// The issue to edit.
67 #[facet(args::positional)]
68 id: String,
69 /// Replace the issue's state.
70 #[facet(args::named)]
71 state: Option<String>,
72 /// Replace the issue's labels (repeatable; give at least one to
73 /// replace the set).
74 #[facet(args::named, args::label = "LABEL", default)]
75 label: Vec<String>,
76 /// Replace the issue's assignees (repeatable; give at least one to
77 /// replace the set).
78 #[facet(args::named, args::label = "USERNAME", default)]
79 assignee: Vec<String>,
80 /// Key to sign with; defaults to `user.signingkey`.
81 #[facet(args::named)]
82 key: Option<PathBuf>,
83 },
84}