fix: clarify review IDs and CLI guidance
This commit is contained in:
+17
-3
@@ -24,7 +24,11 @@ impl Request {
|
||||
let id = if command == "list" {
|
||||
None
|
||||
} else if command == "show" || command == "delete" {
|
||||
let error = "show/delete requires a positive review ID";
|
||||
let error = if command == "show" {
|
||||
"`show` requires a positive review ID.\nUsage: vamp --review show ID [--all]\n`--all` includes resolved comments; it does not select all reviews."
|
||||
} else {
|
||||
"`delete` requires a positive review ID.\nUsage: vamp --review delete REVIEW_ID COMMENT_ID"
|
||||
};
|
||||
let id = args.next().ok_or(error)?;
|
||||
Some(
|
||||
id.to_str()
|
||||
@@ -115,7 +119,10 @@ pub fn run(request: &Request, config: Option<&Path>) -> Result<(), String> {
|
||||
let reviews = if let Some(id) = request.id {
|
||||
let mut review = store
|
||||
.as_ref()
|
||||
.ok_or("Review does not exist in this repository")?
|
||||
.ok_or_else(|| format!(
|
||||
"Review ID {id} not found in {}.\nRun `vamp --review list` to find review IDs for this repository.",
|
||||
root.display()
|
||||
))?
|
||||
.load(&root, id)?;
|
||||
if let Some(comment_id) = request.delete_comment {
|
||||
let index = review
|
||||
@@ -154,8 +161,15 @@ pub fn run(request: &Request, config: Option<&Path>) -> Result<(), String> {
|
||||
if reviews.is_empty() {
|
||||
println!("No stored reviews.");
|
||||
}
|
||||
for review in reviews {
|
||||
for review in &reviews {
|
||||
print!("{}", review.summary_text());
|
||||
println!(
|
||||
"\nShow comments: vamp --review show {}",
|
||||
review.storage_id.unwrap()
|
||||
);
|
||||
}
|
||||
if !reviews.is_empty() {
|
||||
println!("Include resolved comments: add --all");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user