feat(review): add 'apply' reply
Add the 'a(p)ply' part to the review prompt, which applies all actions that were put in so far. When the user has too many packages to review, this allows them to process the packages in chunks of arbitrary sizes. Related to #36.
This commit is contained in:
@@ -21,6 +21,7 @@ pub(super) enum ReviewIntention {
|
|||||||
Invalid,
|
Invalid,
|
||||||
Skip,
|
Skip,
|
||||||
Quit,
|
Quit,
|
||||||
|
Apply,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -88,6 +89,7 @@ impl IntoIterator for ReviewsPerBackend {
|
|||||||
pub(super) enum ContinueWithReview {
|
pub(super) enum ContinueWithReview {
|
||||||
Yes,
|
Yes,
|
||||||
No,
|
No,
|
||||||
|
NoAndApply,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extract_actions(
|
fn extract_actions(
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pub fn review(
|
|||||||
match get_action_for_package(package, &groups, &mut actions, &*backend)? {
|
match get_action_for_package(package, &groups, &mut actions, &*backend)? {
|
||||||
ContinueWithReview::Yes => continue,
|
ContinueWithReview::Yes => continue,
|
||||||
ContinueWithReview::No => return Ok(()),
|
ContinueWithReview::No => return Ok(()),
|
||||||
|
ContinueWithReview::NoAndApply => break,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reviews.push((backend, actions));
|
reviews.push((backend, actions));
|
||||||
@@ -101,6 +102,7 @@ fn get_action_for_package(
|
|||||||
ReviewIntention::Invalid => (),
|
ReviewIntention::Invalid => (),
|
||||||
ReviewIntention::Skip => break,
|
ReviewIntention::Skip => break,
|
||||||
ReviewIntention::Quit => return Ok(ContinueWithReview::No),
|
ReviewIntention::Quit => return Ok(ContinueWithReview::No),
|
||||||
|
ReviewIntention::Apply => return Ok(ContinueWithReview::NoAndApply),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(ContinueWithReview::Yes)
|
Ok(ContinueWithReview::Yes)
|
||||||
@@ -122,6 +124,7 @@ fn ask_user_action_for_package(supports_as_dependency: bool) -> Result<ReviewInt
|
|||||||
'i' => Ok(ReviewIntention::Info),
|
'i' => Ok(ReviewIntention::Info),
|
||||||
'q' => Ok(ReviewIntention::Quit),
|
'q' => Ok(ReviewIntention::Quit),
|
||||||
's' => Ok(ReviewIntention::Skip),
|
's' => Ok(ReviewIntention::Skip),
|
||||||
|
'p' => Ok(ReviewIntention::Apply),
|
||||||
_ => Ok(ReviewIntention::Invalid),
|
_ => Ok(ReviewIntention::Invalid),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +143,7 @@ fn print_query(supports_as_dependency: bool) -> Result<()> {
|
|||||||
query.push_str("(a)s dependency, ");
|
query.push_str("(a)s dependency, ");
|
||||||
}
|
}
|
||||||
|
|
||||||
query.push_str("(q)uit? ");
|
query.push_str("a(p)ply, (q)uit? ");
|
||||||
|
|
||||||
print!("{query}");
|
print!("{query}");
|
||||||
stdout().lock().flush()?;
|
stdout().lock().flush()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user