cli: rename remove to delete
Rename the --remove options to --delete for assign and label, to be more consistent with review, and let this be the standard. Clean up any typos around labels/dids and issues/patches. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
67cbf15e45
commit
3681c0e6df
|
|
@ -69,7 +69,7 @@ $ rad issue list --assigned
|
||||||
Note: this can always be undone with the `unassign` subcommand.
|
Note: this can always be undone with the `unassign` subcommand.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad issue assign d185ee1 --remove did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
$ rad issue assign d185ee1 --delete did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||||
```
|
```
|
||||||
|
|
||||||
Great, now we have communicated to the world about our car's defect.
|
Great, now we have communicated to the world about our car's defect.
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ Usage
|
||||||
rad issue list [--assigned <did>] [--all | --closed | --open | --solved] [<option>...]
|
rad issue list [--assigned <did>] [--all | --closed | --open | --solved] [<option>...]
|
||||||
rad issue open [--title <title>] [--description <text>] [--label <label>] [<option>...]
|
rad issue open [--title <title>] [--description <text>] [--label <label>] [<option>...]
|
||||||
rad issue react <issue-id> [--emoji <char>] [--to <comment>] [<option>...]
|
rad issue react <issue-id> [--emoji <char>] [--to <comment>] [<option>...]
|
||||||
rad issue assign <issue-id> [--add <did>] [--remove <did>] [<option>...]
|
rad issue assign <issue-id> [--add <did>] [--delete <did>] [<option>...]
|
||||||
rad issue label <issue-id> [--add <label>] [--remove <did>] [<option>...]
|
rad issue label <issue-id> [--add <label>] [--delete <label>] [<option>...]
|
||||||
rad issue unlabel <issue-id> --label <label> [<option>...]
|
rad issue unlabel <issue-id> --label <label> [<option>...]
|
||||||
rad issue comment <issue-id> [--message <message>] [--reply-to <comment-id>] [<option>...]
|
rad issue comment <issue-id> [--message <message>] [--reply-to <comment-id>] [<option>...]
|
||||||
rad issue show <issue-id> [<option>...]
|
rad issue show <issue-id> [<option>...]
|
||||||
|
|
@ -48,24 +48,24 @@ Usage
|
||||||
Assign options
|
Assign options
|
||||||
|
|
||||||
-a, --add <did> Add an assignee to the issue (may be specified multiple times).
|
-a, --add <did> Add an assignee to the issue (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
-r, --remove <did> Remove an assignee from the issue (may be specified multiple times).
|
-d, --delete <did> Delete an assignee from the issue (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
Label options
|
Label options
|
||||||
|
|
||||||
-a, --add <label> Add a label to the issue (may be specified multiple times).
|
-a, --add <label> Add a label to the issue (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
-r, --remove <label> Remove a label from the issue (may be specified multiple times).
|
-d, --delete <label> Delete a label from the issue (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
Options
|
Options
|
||||||
|
|
||||||
--no-announce Don't announce issue to peers
|
--no-announce Don't announce issue to peers
|
||||||
--header Show only the issue header, hiding the comments
|
--header Show only the issue header, hiding the comments
|
||||||
--quiet, -q Don't print anything
|
-q, --quiet Don't print anything
|
||||||
--help Print help
|
--help Print help
|
||||||
"#,
|
"#,
|
||||||
};
|
};
|
||||||
|
|
@ -144,13 +144,13 @@ pub enum Operation {
|
||||||
#[derive(Debug, Default, PartialEq, Eq)]
|
#[derive(Debug, Default, PartialEq, Eq)]
|
||||||
pub struct AssignOptions {
|
pub struct AssignOptions {
|
||||||
pub add: BTreeSet<Did>,
|
pub add: BTreeSet<Did>,
|
||||||
pub remove: BTreeSet<Did>,
|
pub delete: BTreeSet<Did>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, PartialEq, Eq)]
|
#[derive(Debug, Default, PartialEq, Eq)]
|
||||||
pub struct LabelOptions {
|
pub struct LabelOptions {
|
||||||
pub add: BTreeSet<Label>,
|
pub add: BTreeSet<Label>,
|
||||||
pub remove: BTreeSet<Label>,
|
pub delete: BTreeSet<Label>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -284,9 +284,9 @@ impl Args for Options {
|
||||||
Short('a') | Long("add") if op == Some(OperationName::Assign) => {
|
Short('a') | Long("add") if op == Some(OperationName::Assign) => {
|
||||||
assign_opts.add.insert(term::args::did(&parser.value()?)?);
|
assign_opts.add.insert(term::args::did(&parser.value()?)?);
|
||||||
}
|
}
|
||||||
Short('r') | Long("remove") if op == Some(OperationName::Assign) => {
|
Short('d') | Long("delete") if op == Some(OperationName::Assign) => {
|
||||||
assign_opts
|
assign_opts
|
||||||
.remove
|
.delete
|
||||||
.insert(term::args::did(&parser.value()?)?);
|
.insert(term::args::did(&parser.value()?)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,12 +298,12 @@ impl Args for Options {
|
||||||
|
|
||||||
label_opts.add.insert(label);
|
label_opts.add.insert(label);
|
||||||
}
|
}
|
||||||
Short('r') | Long("remove") if matches!(op, Some(OperationName::Label)) => {
|
Short('d') | Long("delete") if matches!(op, Some(OperationName::Label)) => {
|
||||||
let val = parser.value()?;
|
let val = parser.value()?;
|
||||||
let name = term::args::string(&val);
|
let name = term::args::string(&val);
|
||||||
let label = Label::new(name)?;
|
let label = Label::new(name)?;
|
||||||
|
|
||||||
label_opts.remove.insert(label);
|
label_opts.delete.insert(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long("quiet") | Short('q') => {
|
Long("quiet") | Short('q') => {
|
||||||
|
|
@ -491,7 +491,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
Operation::Assign {
|
Operation::Assign {
|
||||||
id,
|
id,
|
||||||
opts: AssignOptions { add, remove },
|
opts: AssignOptions { add, delete },
|
||||||
} => {
|
} => {
|
||||||
let id = id.resolve(&repo.backend)?;
|
let id = id.resolve(&repo.backend)?;
|
||||||
let Ok(mut issue) = issues.get_mut(&id) else {
|
let Ok(mut issue) = issues.get_mut(&id) else {
|
||||||
|
|
@ -499,7 +499,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
};
|
};
|
||||||
let assignees = issue
|
let assignees = issue
|
||||||
.assignees()
|
.assignees()
|
||||||
.filter(|did| !remove.contains(did))
|
.filter(|did| !delete.contains(did))
|
||||||
.chain(add.iter())
|
.chain(add.iter())
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
@ -507,7 +507,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
Operation::Label {
|
Operation::Label {
|
||||||
id,
|
id,
|
||||||
opts: LabelOptions { add, remove },
|
opts: LabelOptions { add, delete },
|
||||||
} => {
|
} => {
|
||||||
let id = id.resolve(&repo.backend)?;
|
let id = id.resolve(&repo.backend)?;
|
||||||
let Ok(mut issue) = issues.get_mut(&id) else {
|
let Ok(mut issue) = issues.get_mut(&id) else {
|
||||||
|
|
@ -515,7 +515,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
};
|
};
|
||||||
let labels = issue
|
let labels = issue
|
||||||
.labels()
|
.labels()
|
||||||
.filter(|did| !remove.contains(did))
|
.filter(|did| !delete.contains(did))
|
||||||
.chain(add.iter())
|
.chain(add.iter())
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ Usage
|
||||||
rad patch checkout <patch-id> [<option>...]
|
rad patch checkout <patch-id> [<option>...]
|
||||||
rad patch delete <patch-id> [<option>...]
|
rad patch delete <patch-id> [<option>...]
|
||||||
rad patch redact <revision-id> [<option>...]
|
rad patch redact <revision-id> [<option>...]
|
||||||
rad patch assign <revision-id> [--add <did>] [--remove <did>] [<option>...]
|
rad patch assign <revision-id> [--add <did>] [--delete <did>] [<option>...]
|
||||||
rad patch label <revision-id> [--add <label>] [--remove <label>] [<option>...]
|
rad patch label <revision-id> [--add <label>] [--delete <label>] [<option>...]
|
||||||
rad patch ready <patch-id> [--undo] [<option>...]
|
rad patch ready <patch-id> [--undo] [<option>...]
|
||||||
rad patch edit <patch-id> [<option>...]
|
rad patch edit <patch-id> [<option>...]
|
||||||
rad patch set <patch-id> [<option>...]
|
rad patch set <patch-id> [<option>...]
|
||||||
|
|
@ -77,19 +77,19 @@ Edit options
|
||||||
|
|
||||||
Assign options
|
Assign options
|
||||||
|
|
||||||
-a, --add <did> Add an assignee to the issue (may be specified multiple times).
|
-a, --add <did> Add an assignee to the patch (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
-r, --remove <did> Remove an assignee from the issue (may be specified multiple times).
|
-d, --delete <did> Delete an assignee from the patch (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
Label options
|
Label options
|
||||||
|
|
||||||
-a, --add <label> Add an assignee to the issue (may be specified multiple times).
|
-a, --add <label> Add a label to the patch (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
-r, --remove <label> Remove an assignee from the issue (may be specified multiple times).
|
-d, --delete <label> Delete a label from the patch (may be specified multiple times).
|
||||||
Note: --add will take precedence over --remove
|
Note: --add will take precedence over --delete
|
||||||
|
|
||||||
Update options
|
Update options
|
||||||
|
|
||||||
|
|
@ -145,13 +145,13 @@ pub enum OperationName {
|
||||||
#[derive(Debug, Default, PartialEq, Eq)]
|
#[derive(Debug, Default, PartialEq, Eq)]
|
||||||
pub struct AssignOptions {
|
pub struct AssignOptions {
|
||||||
pub add: BTreeSet<Did>,
|
pub add: BTreeSet<Did>,
|
||||||
pub remove: BTreeSet<Did>,
|
pub delete: BTreeSet<Did>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, PartialEq, Eq)]
|
#[derive(Debug, Default, PartialEq, Eq)]
|
||||||
pub struct LabelOptions {
|
pub struct LabelOptions {
|
||||||
pub add: BTreeSet<Label>,
|
pub add: BTreeSet<Label>,
|
||||||
pub remove: BTreeSet<Label>,
|
pub delete: BTreeSet<Label>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Filter(fn(&patch::State) -> bool);
|
pub struct Filter(fn(&patch::State) -> bool);
|
||||||
|
|
@ -336,9 +336,9 @@ impl Args for Options {
|
||||||
assign_opts.add.insert(term::args::did(&parser.value()?)?);
|
assign_opts.add.insert(term::args::did(&parser.value()?)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
Short('r') | Long("remove") if matches!(op, Some(OperationName::Assign)) => {
|
Short('d') | Long("delete") if matches!(op, Some(OperationName::Assign)) => {
|
||||||
assign_opts
|
assign_opts
|
||||||
.remove
|
.delete
|
||||||
.insert(term::args::did(&parser.value()?)?);
|
.insert(term::args::did(&parser.value()?)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,12 +351,12 @@ impl Args for Options {
|
||||||
label_opts.add.insert(label);
|
label_opts.add.insert(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
Short('r') | Long("remove") if matches!(op, Some(OperationName::Label)) => {
|
Short('d') | Long("delete") if matches!(op, Some(OperationName::Label)) => {
|
||||||
let val = parser.value()?;
|
let val = parser.value()?;
|
||||||
let name = term::args::string(&val);
|
let name = term::args::string(&val);
|
||||||
let label = Label::new(name)?;
|
let label = Label::new(name)?;
|
||||||
|
|
||||||
label_opts.remove.insert(label);
|
label_opts.delete.insert(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
// List options.
|
// List options.
|
||||||
|
|
@ -594,17 +594,17 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
Operation::Assign {
|
Operation::Assign {
|
||||||
patch_id,
|
patch_id,
|
||||||
opts: AssignOptions { add, remove },
|
opts: AssignOptions { add, delete },
|
||||||
} => {
|
} => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
assign::run(&patch_id, add, remove, &profile, &repository)?;
|
assign::run(&patch_id, add, delete, &profile, &repository)?;
|
||||||
}
|
}
|
||||||
Operation::Label {
|
Operation::Label {
|
||||||
patch_id,
|
patch_id,
|
||||||
opts: LabelOptions { add, remove },
|
opts: LabelOptions { add, delete },
|
||||||
} => {
|
} => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
label::run(&patch_id, add, remove, &profile, &repository)?;
|
label::run(&patch_id, add, delete, &profile, &repository)?;
|
||||||
}
|
}
|
||||||
Operation::Set { patch_id } => {
|
Operation::Set { patch_id } => {
|
||||||
let patches = radicle::cob::patch::Patches::open(&repository)?;
|
let patches = radicle::cob::patch::Patches::open(&repository)?;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use crate::terminal as term;
|
||||||
pub fn run(
|
pub fn run(
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
add: BTreeSet<Did>,
|
add: BTreeSet<Did>,
|
||||||
remove: BTreeSet<Did>,
|
delete: BTreeSet<Did>,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
repository: &Repository,
|
repository: &Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
|
@ -21,7 +21,7 @@ pub fn run(
|
||||||
};
|
};
|
||||||
let assignees = patch
|
let assignees = patch
|
||||||
.assignees()
|
.assignees()
|
||||||
.filter(|did| !remove.contains(did))
|
.filter(|did| !delete.contains(did))
|
||||||
.chain(add)
|
.chain(add)
|
||||||
.collect::<BTreeSet<_>>();
|
.collect::<BTreeSet<_>>();
|
||||||
patch.assign(assignees, &signer)?;
|
patch.assign(assignees, &signer)?;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use crate::terminal as term;
|
||||||
pub fn run(
|
pub fn run(
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
add: BTreeSet<Label>,
|
add: BTreeSet<Label>,
|
||||||
remove: BTreeSet<Label>,
|
delete: BTreeSet<Label>,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
repository: &Repository,
|
repository: &Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
|
@ -18,7 +18,7 @@ pub fn run(
|
||||||
};
|
};
|
||||||
let labels = patch
|
let labels = patch
|
||||||
.labels()
|
.labels()
|
||||||
.filter(|l| !remove.contains(l))
|
.filter(|l| !delete.contains(l))
|
||||||
.chain(add.iter())
|
.chain(add.iter())
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue