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.
|
||||
|
||||
```
|
||||
$ 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.
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ Usage
|
|||
rad issue list [--assigned <did>] [--all | --closed | --open | --solved] [<option>...]
|
||||
rad issue open [--title <title>] [--description <text>] [--label <label>] [<option>...]
|
||||
rad issue react <issue-id> [--emoji <char>] [--to <comment>] [<option>...]
|
||||
rad issue assign <issue-id> [--add <did>] [--remove <did>] [<option>...]
|
||||
rad issue label <issue-id> [--add <label>] [--remove <did>] [<option>...]
|
||||
rad issue assign <issue-id> [--add <did>] [--delete <did>] [<option>...]
|
||||
rad issue label <issue-id> [--add <label>] [--delete <label>] [<option>...]
|
||||
rad issue unlabel <issue-id> --label <label> [<option>...]
|
||||
rad issue comment <issue-id> [--message <message>] [--reply-to <comment-id>] [<option>...]
|
||||
rad issue show <issue-id> [<option>...]
|
||||
|
|
@ -48,24 +48,24 @@ Usage
|
|||
Assign options
|
||||
|
||||
-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).
|
||||
Note: --add will take precedence over --remove
|
||||
-d, --delete <did> Delete an assignee from the issue (may be specified multiple times).
|
||||
Note: --add will take precedence over --delete
|
||||
|
||||
Label options
|
||||
|
||||
-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).
|
||||
Note: --add will take precedence over --remove
|
||||
-d, --delete <label> Delete a label from the issue (may be specified multiple times).
|
||||
Note: --add will take precedence over --delete
|
||||
|
||||
Options
|
||||
|
||||
--no-announce Don't announce issue to peers
|
||||
--header Show only the issue header, hiding the comments
|
||||
--quiet, -q Don't print anything
|
||||
-q, --quiet Don't print anything
|
||||
--help Print help
|
||||
"#,
|
||||
};
|
||||
|
|
@ -144,13 +144,13 @@ pub enum Operation {
|
|||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct AssignOptions {
|
||||
pub add: BTreeSet<Did>,
|
||||
pub remove: BTreeSet<Did>,
|
||||
pub delete: BTreeSet<Did>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct LabelOptions {
|
||||
pub add: BTreeSet<Label>,
|
||||
pub remove: BTreeSet<Label>,
|
||||
pub delete: BTreeSet<Label>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -284,9 +284,9 @@ impl Args for Options {
|
|||
Short('a') | Long("add") if op == Some(OperationName::Assign) => {
|
||||
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
|
||||
.remove
|
||||
.delete
|
||||
.insert(term::args::did(&parser.value()?)?);
|
||||
}
|
||||
|
||||
|
|
@ -298,12 +298,12 @@ impl Args for Options {
|
|||
|
||||
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 name = term::args::string(&val);
|
||||
let label = Label::new(name)?;
|
||||
|
||||
label_opts.remove.insert(label);
|
||||
label_opts.delete.insert(label);
|
||||
}
|
||||
|
||||
Long("quiet") | Short('q') => {
|
||||
|
|
@ -491,7 +491,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|||
}
|
||||
Operation::Assign {
|
||||
id,
|
||||
opts: AssignOptions { add, remove },
|
||||
opts: AssignOptions { add, delete },
|
||||
} => {
|
||||
let id = id.resolve(&repo.backend)?;
|
||||
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
|
||||
.assignees()
|
||||
.filter(|did| !remove.contains(did))
|
||||
.filter(|did| !delete.contains(did))
|
||||
.chain(add.iter())
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
|
@ -507,7 +507,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|||
}
|
||||
Operation::Label {
|
||||
id,
|
||||
opts: LabelOptions { add, remove },
|
||||
opts: LabelOptions { add, delete },
|
||||
} => {
|
||||
let id = id.resolve(&repo.backend)?;
|
||||
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
|
||||
.labels()
|
||||
.filter(|did| !remove.contains(did))
|
||||
.filter(|did| !delete.contains(did))
|
||||
.chain(add.iter())
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ Usage
|
|||
rad patch checkout <patch-id> [<option>...]
|
||||
rad patch delete <patch-id> [<option>...]
|
||||
rad patch redact <revision-id> [<option>...]
|
||||
rad patch assign <revision-id> [--add <did>] [--remove <did>] [<option>...]
|
||||
rad patch label <revision-id> [--add <label>] [--remove <label>] [<option>...]
|
||||
rad patch assign <revision-id> [--add <did>] [--delete <did>] [<option>...]
|
||||
rad patch label <revision-id> [--add <label>] [--delete <label>] [<option>...]
|
||||
rad patch ready <patch-id> [--undo] [<option>...]
|
||||
rad patch edit <patch-id> [<option>...]
|
||||
rad patch set <patch-id> [<option>...]
|
||||
|
|
@ -77,19 +77,19 @@ Edit options
|
|||
|
||||
Assign options
|
||||
|
||||
-a, --add <did> Add an assignee to the issue (may be specified multiple times).
|
||||
Note: --add will take precedence over --remove
|
||||
-a, --add <did> Add an assignee to the patch (may be specified multiple times).
|
||||
Note: --add will take precedence over --delete
|
||||
|
||||
-r, --remove <did> Remove an assignee from the issue (may be specified multiple times).
|
||||
Note: --add will take precedence over --remove
|
||||
-d, --delete <did> Delete an assignee from the patch (may be specified multiple times).
|
||||
Note: --add will take precedence over --delete
|
||||
|
||||
Label options
|
||||
|
||||
-a, --add <label> Add an assignee to the issue (may be specified multiple times).
|
||||
Note: --add will take precedence over --remove
|
||||
-a, --add <label> Add a label to the patch (may be specified multiple times).
|
||||
Note: --add will take precedence over --delete
|
||||
|
||||
-r, --remove <label> Remove an assignee from the issue (may be specified multiple times).
|
||||
Note: --add will take precedence over --remove
|
||||
-d, --delete <label> Delete a label from the patch (may be specified multiple times).
|
||||
Note: --add will take precedence over --delete
|
||||
|
||||
Update options
|
||||
|
||||
|
|
@ -145,13 +145,13 @@ pub enum OperationName {
|
|||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct AssignOptions {
|
||||
pub add: BTreeSet<Did>,
|
||||
pub remove: BTreeSet<Did>,
|
||||
pub delete: BTreeSet<Did>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct LabelOptions {
|
||||
pub add: BTreeSet<Label>,
|
||||
pub remove: BTreeSet<Label>,
|
||||
pub delete: BTreeSet<Label>,
|
||||
}
|
||||
|
||||
pub struct Filter(fn(&patch::State) -> bool);
|
||||
|
|
@ -336,9 +336,9 @@ impl Args for Options {
|
|||
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
|
||||
.remove
|
||||
.delete
|
||||
.insert(term::args::did(&parser.value()?)?);
|
||||
}
|
||||
|
||||
|
|
@ -351,12 +351,12 @@ impl Args for Options {
|
|||
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 name = term::args::string(&val);
|
||||
let label = Label::new(name)?;
|
||||
|
||||
label_opts.remove.insert(label);
|
||||
label_opts.delete.insert(label);
|
||||
}
|
||||
|
||||
// List options.
|
||||
|
|
@ -594,17 +594,17 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|||
}
|
||||
Operation::Assign {
|
||||
patch_id,
|
||||
opts: AssignOptions { add, remove },
|
||||
opts: AssignOptions { add, delete },
|
||||
} => {
|
||||
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 {
|
||||
patch_id,
|
||||
opts: LabelOptions { add, remove },
|
||||
opts: LabelOptions { add, delete },
|
||||
} => {
|
||||
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 } => {
|
||||
let patches = radicle::cob::patch::Patches::open(&repository)?;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use crate::terminal as term;
|
|||
pub fn run(
|
||||
patch_id: &PatchId,
|
||||
add: BTreeSet<Did>,
|
||||
remove: BTreeSet<Did>,
|
||||
delete: BTreeSet<Did>,
|
||||
profile: &Profile,
|
||||
repository: &Repository,
|
||||
) -> anyhow::Result<()> {
|
||||
|
|
@ -21,7 +21,7 @@ pub fn run(
|
|||
};
|
||||
let assignees = patch
|
||||
.assignees()
|
||||
.filter(|did| !remove.contains(did))
|
||||
.filter(|did| !delete.contains(did))
|
||||
.chain(add)
|
||||
.collect::<BTreeSet<_>>();
|
||||
patch.assign(assignees, &signer)?;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use crate::terminal as term;
|
|||
pub fn run(
|
||||
patch_id: &PatchId,
|
||||
add: BTreeSet<Label>,
|
||||
remove: BTreeSet<Label>,
|
||||
delete: BTreeSet<Label>,
|
||||
profile: &Profile,
|
||||
repository: &Repository,
|
||||
) -> anyhow::Result<()> {
|
||||
|
|
@ -18,7 +18,7 @@ pub fn run(
|
|||
};
|
||||
let labels = patch
|
||||
.labels()
|
||||
.filter(|l| !remove.contains(l))
|
||||
.filter(|l| !delete.contains(l))
|
||||
.chain(add.iter())
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue