Backend trait refactors
- Refactor the confusing/bodgy consts backend macro to use a single `BackendInfo` struct - Combine `supports_as_dependency()` and the `switches_dependency` into a single `Option` type as that is a better representation as it is an optional backend feature. - Add more types like `Packages`, `Sections` for uniformity. - Added a crate-private prelude and switches all imports to use a prelude glob import (excluding functions because it's nice to only be importing types) - Refactored Backend section name in logging by implementing Display for `AnyBackend` that just prints the `section`
This commit is contained in:
@@ -5,10 +5,8 @@ use std::io::{stdin, stdout, Write};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::backend::backend_trait::Backend;
|
||||
use crate::backend::todo_per_backend::ToDoPerBackend;
|
||||
use crate::prelude::*;
|
||||
use crate::ui::{get_user_confirmation, read_single_char_from_terminal};
|
||||
use crate::{Group, Groups, Package};
|
||||
|
||||
use self::datastructures::{ContinueWithReview, ReviewAction, ReviewIntention, ReviewsPerBackend};
|
||||
use self::strategy::Strategy;
|
||||
@@ -24,7 +22,7 @@ pub fn review(todo_per_backend: ToDoPerBackend, groups: &Groups) -> Result<()> {
|
||||
'outer: for (backend, packages) in todo_per_backend {
|
||||
let mut actions = vec![];
|
||||
for package in packages {
|
||||
println!("{}: {package}", backend.get_section());
|
||||
println!("{}: {package}", backend.backend_info().section);
|
||||
match get_action_for_package(package, groups, &mut actions, &backend)? {
|
||||
ContinueWithReview::Yes => continue,
|
||||
ContinueWithReview::No => return Ok(()),
|
||||
|
||||
Reference in New Issue
Block a user